diff
stringlengths 65
26.7k
| message
stringlengths 7
9.92k
|
|---|---|
diff --git a/app/models/menu.rb b/app/models/menu.rb
index abc1234..def5678 100644
--- a/app/models/menu.rb
+++ b/app/models/menu.rb
@@ -2,7 +2,7 @@ has_many :links, class_name: 'MenuLink'
def self.links_for_menu_cached(menu_name)
- Rails.cache.fetch(Menu.where(name: menu_name).last.cache_key, expires_in: 24.hours) do
+ Rails.cache.fetch(Menu.where(name: menu_name).last, expires_in: 24.hours) do
Menu.where(name: menu_name).last.links.sort_by{|l| l.preferred_order}.to_a
end
end
|
Remove unnecessary call to cache_key
|
diff --git a/lib/sprockets/es6.rb b/lib/sprockets/es6.rb
index abc1234..def5678 100644
--- a/lib/sprockets/es6.rb
+++ b/lib/sprockets/es6.rb
@@ -33,7 +33,7 @@ end
append_path ES6to5::Source.root
- register_mime_type 'text/ecmascript-6', extensions: ['.es6'], charset: EncodingUtils::DETECT_UNICODE
+ register_mime_type 'text/ecmascript-6', extensions: ['.es6'], charset: :unicode
register_transformer 'text/ecmascript-6', 'application/javascript', ES6
register_preprocessor 'text/ecmascript-6', DirectiveProcessor
end
|
Switch to new charset detector shorthand
|
diff --git a/lib/appsignal/integrations/rails.rb b/lib/appsignal/integrations/rails.rb
index abc1234..def5678 100644
--- a/lib/appsignal/integrations/rails.rb
+++ b/lib/appsignal/integrations/rails.rb
@@ -22,7 +22,7 @@ # Load config
Appsignal.config = Appsignal::Config.new(
Rails.root,
- Rails.env,
+ ENV.fetch('APPSIGNAL_APP_ENV', Rails.env),
:name => Rails.application.class.parent_name
)
|
Set the app environment using the APPSIGNAL_APP_ENV env var
|
diff --git a/lib/benchmark/memory/measurement.rb b/lib/benchmark/memory/measurement.rb
index abc1234..def5678 100644
--- a/lib/benchmark/memory/measurement.rb
+++ b/lib/benchmark/memory/measurement.rb
@@ -1,3 +1,4 @@+require "forwardable"
require "benchmark/memory/measurement/metric"
module Benchmark
|
Add forgotten require of Forwardable
|
diff --git a/spec/support/delete_button.rb b/spec/support/delete_button.rb
index abc1234..def5678 100644
--- a/spec/support/delete_button.rb
+++ b/spec/support/delete_button.rb
@@ -5,6 +5,6 @@ button = find('div.ui.button', text: text)
button.click
expect(button).to have_css('.menu.visible:not(.animating)')
- click_link('Confirm Delete')
+ click_link("Confirm #{text}")
end
end
|
Fix delete button clicker in Capybara tests
After ausaccessfed/aaf-lipstick#14 these tests were expecting the old
(incorrect) 'Confirm Delete' button text which is no longer present.
Fixes test failures after upgrading the lipstick library.
|
diff --git a/app/models/user.rb b/app/models/user.rb
index abc1234..def5678 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -5,7 +5,7 @@
acts_as_authentic do |c|
c.login_field = 'email'
- c.crypto_provider = Authlogic::CryptoProviders::Sha512
+ #c.crypto_provider = Authlogic::CryptoProviders::Sha512
end
def generate_authentication_token
|
Disable Sha512 authlogic crypto provider
|
diff --git a/app/models/user.rb b/app/models/user.rb
index abc1234..def5678 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -2,4 +2,27 @@ # Remember to create a migration!
has_many :rounds
has_many :guesses, through: :rounds
+
+ validates :email, presence: true, uniqueness: true
end
+
+def password
+ @password = BCrypt::Password.new(encrypted_password)
+end
+
+def password=(new_password)
+ @password = BCrypt::Password.create(new_password)
+ self.encrypted_password = @password
+end
+
+self.authenticate(user = {})
+ @user = self.find_by(email: params[:email])
+
+ if @user.password == params[:password]
+ @user
+ else
+ nil
+ end
+end
+
+
|
Create reader and writer password methods, and add authentication method with some validations
|
diff --git a/lib/tasks/users.rake b/lib/tasks/users.rake
index abc1234..def5678 100644
--- a/lib/tasks/users.rake
+++ b/lib/tasks/users.rake
@@ -0,0 +1,20 @@+namespace :users do
+ namespace :admin do
+ def privileges(state)
+ raise unless ENV['email']
+ u = User.find_by_email!(ENV['email'])
+ u.is_admin = state
+ u.save!
+ end
+
+ desc "grant admin privileges to a user: rake users:admin:grant email='joe@bloggs.com'"
+ task :grant => :environment do
+ privileges(true)
+ end
+
+ desc "remove admin privileges from a user: rake users:admin:remove email='joe@bloggs.com'"
+ task :remove => :environment do
+ privileges(false)
+ end
+ end
+end
|
Add Rake task to grant and remove Admin privileges
|
diff --git a/lib/formtastic/inputs/file_input.rb b/lib/formtastic/inputs/file_input.rb
index abc1234..def5678 100644
--- a/lib/formtastic/inputs/file_input.rb
+++ b/lib/formtastic/inputs/file_input.rb
@@ -13,7 +13,7 @@ #
# <%= semantic_form_for(@user, :html => { :multipart => true }) do |f| %>
# <%= f.inputs do %>
- # <%= f.input :email_address, :as => :email %>
+ # <%= f.input :avatar, :as => :file %>
# <% end %>
# <% end %>
#
@@ -21,8 +21,8 @@ # <fieldset>
# <ol>
# <li class="email">
- # <label for="user_email_address">Email address</label>
- # <input type="email" id="user_email_address" name="user[email_address]">
+ # <label for="user_avatar">Avatar</label>
+ # <input type="file" id="user_avatar" name="user[avatar]">
# </li>
# </ol>
# </fieldset>
@@ -39,4 +39,4 @@ end
end
end
-end+end
|
Fix example code for FileInput
Closes GH-635
|
diff --git a/lib/onebox/engine/youtube_onebox.rb b/lib/onebox/engine/youtube_onebox.rb
index abc1234..def5678 100644
--- a/lib/onebox/engine/youtube_onebox.rb
+++ b/lib/onebox/engine/youtube_onebox.rb
@@ -7,11 +7,16 @@ matches_regexp /^https?:\/\/(?:www\.)?(?:youtube\.com|youtu\.be)\/.+$/
def to_html
- rewrite_agnostic(append_embed_wmode(raw[:html]))
+ rewrite_agnostic(append_params(raw[:html]))
end
- def append_embed_wmode(html)
- html.gsub /(src="[^"]+)/, '\1&wmode=opaque'
+ def append_params(html)
+ result = html.dup
+ result.gsub! /(src="[^"]+)/, '\1&wmode=opaque'
+ if url =~ /t=(\d+)/
+ result.gsub! /(src="[^"]+)/, '\1&start=' + Regexp.last_match[1]
+ end
+ result
end
def rewrite_agnostic(html)
|
Support for embedding YouTube links to particular times
|
diff --git a/config.ru b/config.ru
index abc1234..def5678 100644
--- a/config.ru
+++ b/config.ru
@@ -1,15 +1,15 @@ # This file is used by Rack-based servers to start the application.
-require 'rack-rewrite'
-
-DOMAIN = 'aqueousband.net'
-
-# Redirect to the www version of the domain in production
-use Rack::Rewrite do
- r301 %r{.*}, "http://#{DOMAIN}$&", :if => Proc.new {|rack_env|
- rack_env['SERVER_NAME'] != DOMAIN && ENV['RAILS_ENV'] == "production"
- }
-end
+#require 'rack-rewrite'
+#
+#DOMAIN = 'aqueousband.net'
+#
+## Redirect to the www version of the domain in production
+#use Rack::Rewrite do
+# r301 %r{.*}, "http://#{DOMAIN}$&", :if => Proc.new {|rack_env|
+# rack_env['SERVER_NAME'] != DOMAIN && ENV['RAILS_ENV'] == "production"
+# }
+#end
require ::File.expand_path('../config/environment', __FILE__)
run Rails.application
|
Disable rack rewrite for now
|
diff --git a/spec/functional/command/init_spec.rb b/spec/functional/command/init_spec.rb
index abc1234..def5678 100644
--- a/spec/functional/command/init_spec.rb
+++ b/spec/functional/command/init_spec.rb
@@ -0,0 +1,29 @@+require File.expand_path('../../../spec_helper', __FILE__)
+
+module Pod
+ describe Command::Init do
+
+ it "runs with no parameters" do
+ lambda { run_command('init') }.should.not.raise CLAide::Help
+ end
+
+ it "complains when given parameters" do
+ lambda { run_command('init', 'create') }.should.raise CLAide::Help
+ lambda { run_command('init', '--create') }.should.raise CLAide::Help
+ lambda { run_command('init', 'NAME') }.should.raise CLAide::Help
+ lambda { run_command('init', 'createa') }.should.raise CLAide::Help
+ lambda { run_command('init', 'agument1', '2') }.should.raise CLAide::Help
+ lambda { run_command('init', 'which') }.should.raise CLAide::Help
+ lambda { run_command('init', 'cat') }.should.raise CLAide::Help
+ lambda { run_command('init', 'edit') }.should.raise CLAide::Help
+ end
+
+ extend SpecHelper::TemporaryRepos
+
+ it "creates a Podfile" do
+ run_command('init')
+ path = temporary_directory + 'Podfile'
+ File.exists?(path).should == true
+ end
+ end
+end
|
Add a basic spec for the init subcommand.
|
diff --git a/spec/graphql/schema/addition_spec.rb b/spec/graphql/schema/addition_spec.rb
index abc1234..def5678 100644
--- a/spec/graphql/schema/addition_spec.rb
+++ b/spec/graphql/schema/addition_spec.rb
@@ -0,0 +1,16 @@+# frozen_string_literal: true
+require "spec_helper"
+
+describe GraphQL::Schema::Addition do
+ it "handles duplicate types with cycles" do
+ duplicate_types_schema = Class.new(GraphQL::Schema)
+ duplicate_types = 2.times.map {
+ Class.new(GraphQL::Schema::Object) do
+ graphql_name "Thing"
+ field :thing, self
+ end
+ }
+ duplicate_types_schema.orphan_types(duplicate_types)
+ assert_equal 2, duplicate_types_schema.send(:own_types)["Thing"].size
+ end
+end
|
Add test for addition fix
|
diff --git a/libraries/plugins.rb b/libraries/plugins.rb
index abc1234..def5678 100644
--- a/libraries/plugins.rb
+++ b/libraries/plugins.rb
@@ -1,7 +1,7 @@ class Chef
class Recipe
def add_vim_git_plugin(repository_url)
- node.set[:vim_config][:bundles][:git] = node[:vim_config][:bundles][:git].dup << repository_url unless node[:vim_config][:bundles][:git].include?(repository_url)
+ node.override[:vim_config][:bundles][:git] = node[:vim_config][:bundles][:git].dup << repository_url unless node[:vim_config][:bundles][:git].include?(repository_url)
end
def plugin_dirs_to_delete
|
Use override instead of set node attribute
|
diff --git a/lib/versionator/detector/drupal6.rb b/lib/versionator/detector/drupal6.rb
index abc1234..def5678 100644
--- a/lib/versionator/detector/drupal6.rb
+++ b/lib/versionator/detector/drupal6.rb
@@ -24,8 +24,6 @@ !is_openatrium? && installed_version.major < 7 if super
end
- private
-
def is_openatrium?
Dir.exists?(File.expand_path("profiles/openatrium", base_dir))
end
|
Fix code style in Drupal6 detector
|
diff --git a/spec/support/isolated_environment.rb b/spec/support/isolated_environment.rb
index abc1234..def5678 100644
--- a/spec/support/isolated_environment.rb
+++ b/spec/support/isolated_environment.rb
@@ -7,6 +7,10 @@ around do |example|
Dir.mktmpdir do |tmpdir|
original_home = ENV['HOME']
+
+ # Make sure to expand all symlinks in the path first. Otherwise we may
+ # get mismatched pathnames when loading config files later on.
+ tmpdir = File.realpath(tmpdir)
# Make upwards search for .rubocop.yml files stop at this directory.
Rubocop::ConfigLoader.root_level = tmpdir
|
Fix the isolated environment spec on OS X
The reason this spec was failing is that on OS X the temp directory is
actually something like this:
/var/folders/bg/8sxn6p0j5kv0j1z__3hwz5nm0000gn/T/
However, /var is not an actual folder, but a symlink to /private/var and
that causes the check for root_level in ConfigLoader.dirs_to_search() to
fail and the ascend to continue.
|
diff --git a/lib/salesforce_bulk/query_result_collection.rb b/lib/salesforce_bulk/query_result_collection.rb
index abc1234..def5678 100644
--- a/lib/salesforce_bulk/query_result_collection.rb
+++ b/lib/salesforce_bulk/query_result_collection.rb
@@ -13,7 +13,7 @@ @batch_id = batch_id
@result_id = result_id
@result_ids = result_ids
- @current_index = result_ids.index(result_id)
+ @current_index = result_ids.index(result_id) || 0
end
def next?
|
Update to pass new assertion where if no result_id index was found we use a default index value of 0.
|
diff --git a/lib/vagrant-cachier/cap/linux/composer_path.rb b/lib/vagrant-cachier/cap/linux/composer_path.rb
index abc1234..def5678 100644
--- a/lib/vagrant-cachier/cap/linux/composer_path.rb
+++ b/lib/vagrant-cachier/cap/linux/composer_path.rb
@@ -7,8 +7,11 @@ composer_path = nil
machine.communicate.tap do |comm|
return unless comm.test('which php')
+ # on some VMs an extra new line seems to come out, so we loop over
+ # the output just in case
+ composer_path = ''
comm.execute 'echo $HOME' do |buffer, output|
- composer_path = output.chomp if buffer == :stdout
+ composer_path += output.chomp if buffer == :stdout
end
end
return "#{composer_path}/.composer/cache"
|
Resolve $HOME even if VM spits bogus new lines
Fixes issue #122
|
diff --git a/recipes/default.rb b/recipes/default.rb
index abc1234..def5678 100644
--- a/recipes/default.rb
+++ b/recipes/default.rb
@@ -11,6 +11,7 @@ minute '30'
user 'root'
command "#{node['aide']['binary']} #{node['aide']['extra_parameters']} --check -V3"
+ mailto node['aide']['cron_mailto'] if node['aide']['cron_mailto']
end
cron_d 'aide-detailed' do
@@ -20,6 +21,7 @@ weekday '1'
user 'root'
command "#{node['aide']['binary']} #{node['aide']['extra_parameters']} --check -V5"
+ mailto node['aide']['cron_mailto'] if node['aide']['cron_mailto']
end
bash 'generate_database' do
|
Use cron_mailto attribute for cron jobs if set
|
diff --git a/recipes/default.rb b/recipes/default.rb
index abc1234..def5678 100644
--- a/recipes/default.rb
+++ b/recipes/default.rb
@@ -8,7 +8,7 @@ #
node['opsworks']['instance']['layers'].each do |layer|
- if Regexp.new(node['opsworks-mongodb']['replset_pattern']).match(layer)
+ if Regexp.new(node['opsworks-mongodb']['replset_layer_pattern']).match(layer)
node.normal['mongodb']['shard_name'] = $1
node.normal['mongodb']['config']['replSet'] = $1
end
|
Refactor to new pattern name.
|
diff --git a/spec/features/search_spec.rb b/spec/features/search_spec.rb
index abc1234..def5678 100644
--- a/spec/features/search_spec.rb
+++ b/spec/features/search_spec.rb
@@ -1,8 +1,13 @@ require 'spec_helper'
+<<<<<<< HEAD
describe 'searching', :type => :feature do
before { GenericFile.destroy_all }
let!(:file) { FactoryGirl.create(:public_file, title: "Toothbrush") }
+=======
+describe 'searching' do
+ let!(:file) { FactoryGirl.create(:public_file, title: ["Toothbrush"]) }
+>>>>>>> Set title as a multivalued field
context "as a public user" do
it "should find the file and have a gallery" do
|
Set title as a multivalued field
|
diff --git a/spec/models/resource_spec.rb b/spec/models/resource_spec.rb
index abc1234..def5678 100644
--- a/spec/models/resource_spec.rb
+++ b/spec/models/resource_spec.rb
@@ -1,4 +1,31 @@ require 'rails_helper'
describe Resource, type: :model do
+ describe '#upload' do
+ let(:blog) { create :blog }
+ let(:resource) { create :resource, blog: blog }
+ let(:img_resource) { Resource.create blog: blog, upload: file_upload('testfile.png', 'image/png') }
+
+ it 'stores files in the correct location' do
+ expected_path = Rails.root.join('public', 'files/resource/1', 'testfile.txt')
+ expect(resource.upload.file.file).to eq expected_path.to_s
+ end
+
+ it 'stores resized images in the correct location' do
+ thumb_path = Rails.root.join('public', 'files/resource/1', 'thumb_testfile.png')
+ expect(img_resource.upload.thumb.file.file).to eq thumb_path.to_s
+ end
+
+ it 'creates three image versions' do
+ expect(img_resource.upload.versions.keys).to match_array [:thumb, :medium, :avatar]
+ end
+
+ it 'gives the correct url for the attachment' do
+ expect(resource.upload_url).to eq '/files/resource/1/testfile.txt'
+ end
+
+ it 'gives the correct url for the image versions' do
+ expect(img_resource.upload_url(:thumb)).to eq '/files/resource/1/thumb_testfile.png'
+ end
+ end
end
|
Add tests for Resource upload behavior
|
diff --git a/core/app/models/spree/promotion_chooser.rb b/core/app/models/spree/promotion_chooser.rb
index abc1234..def5678 100644
--- a/core/app/models/spree/promotion_chooser.rb
+++ b/core/app/models/spree/promotion_chooser.rb
@@ -12,7 +12,7 @@ if best_promotion_adjustment
@adjustments.select(&:eligible?).each do |adjustment|
next if adjustment == best_promotion_adjustment
- adjustment.update_columns(eligible: false)
+ adjustment.update_columns(eligible: false, updated_at: Time.current)
end
best_promotion_adjustment.amount
else
|
Update updated_at timestamp on eligibility change
The _adjustment jbuilder view caches based on the adjustment updated_at timestamp. Currently if a promotion is made ineligible by this class and a previous call to api/orders#show has been made, a subsequent calls will send back the cached view.
|
diff --git a/test/sepa/banks/nordea/nordea_renew_cert_application_request_test.rb b/test/sepa/banks/nordea/nordea_renew_cert_application_request_test.rb
index abc1234..def5678 100644
--- a/test/sepa/banks/nordea/nordea_renew_cert_application_request_test.rb
+++ b/test/sepa/banks/nordea/nordea_renew_cert_application_request_test.rb
@@ -29,4 +29,9 @@ test "customer id is set correctly" do
assert_equal @doc.at_css("CustomerId").content, @params[:customer_id]
end
+
+ test "timestamp is set correctly" do
+ timestamp = Time.strptime(@doc.at_css("Timestamp").content, '%Y-%m-%dT%H:%M:%S%z')
+ assert timestamp <= Time.now && timestamp > (Time.now - 60), "Timestamp was not set correctly"
+ end
end
|
Test that timestamp is set correctly
|
diff --git a/lib/badgeoverflow/core/models/badges/moderation/citizen_patrol.rb b/lib/badgeoverflow/core/models/badges/moderation/citizen_patrol.rb
index abc1234..def5678 100644
--- a/lib/badgeoverflow/core/models/badges/moderation/citizen_patrol.rb
+++ b/lib/badgeoverflow/core/models/badges/moderation/citizen_patrol.rb
@@ -9,5 +9,5 @@ class Deputy < CitizenPatrol
end
-class Marshal < CitizenPatrol
-end
+# class Marshal < CitizenPatrol
+# end
|
Comment out Marshal badge for time being (clashing with existing Ruby class)
|
diff --git a/test/helpers/sitemap_helper_test.rb b/test/helpers/sitemap_helper_test.rb
index abc1234..def5678 100644
--- a/test/helpers/sitemap_helper_test.rb
+++ b/test/helpers/sitemap_helper_test.rb
@@ -0,0 +1,12 @@+require 'test_helper'
+
+#
+# == SitemapHelper Test
+#
+class SitemapHelperTest < ActionView::TestCase
+ include Rails.application.routes.url_helpers
+
+ test 'should return correct rss_module content' do
+ skip 'Add method is not understood by the test'
+ end
+end
|
Add test file for SitemapHelper
|
diff --git a/Framezilla.podspec b/Framezilla.podspec
index abc1234..def5678 100644
--- a/Framezilla.podspec
+++ b/Framezilla.podspec
@@ -1,6 +1,6 @@ Pod::Spec.new do |spec|
spec.name = "Framezilla"
- spec.version = "2.0.0"
+ spec.version = "2.1.0"
spec.summary = "Comfortable syntax for working with frames."
spec.homepage = "https://github.com/Otbivnoe/Framezilla"
|
Update pod version -> 2.1.0
|
diff --git a/tools/test_common.rb b/tools/test_common.rb
index abc1234..def5678 100644
--- a/tools/test_common.rb
+++ b/tools/test_common.rb
@@ -1,3 +1,5 @@+# frozen_string_literal: true
+
if ENV["BUILDKITE"]
require "minitest/reporters"
require "fileutils"
|
Fix rubocop offence for `Style/FrozenStringLiteralComment`
```
% be rubocop -a
Inspecting 2777 files
..........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................C..............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
Offenses:
tools/test_common.rb:1:1: C: [Corrected] Style/FrozenStringLiteralComment: Missing magic comment # frozen_string_literal: true.
if ENV["BUILDKITE"]
^
2777 files inspected, 1 offense detected, 1 offense corrected
```
|
diff --git a/lib/active_utils/common/utils.rb b/lib/active_utils/common/utils.rb
index abc1234..def5678 100644
--- a/lib/active_utils/common/utils.rb
+++ b/lib/active_utils/common/utils.rb
@@ -1,4 +1,4 @@-require 'active_support/secure_random'
+require 'securerandom'
module ActiveMerchant #:nodoc:
module Utils #:nodoc:
|
Use ruby core securerandom as it's removed from latest activesupport
|
diff --git a/lib/exercism/use_cases/notify.rb b/lib/exercism/use_cases/notify.rb
index abc1234..def5678 100644
--- a/lib/exercism/use_cases/notify.rb
+++ b/lib/exercism/use_cases/notify.rb
@@ -23,10 +23,13 @@ user: to,
from: from.username,
regarding: about,
- link: send("#{about}_link".to_sym)
+ link: link(about)
})
end
+ def link(about)
+ "/" + send("#{about}_link".to_sym)
+ end
def approval_link
[
submission.user.username,
|
Prepend `/` to notification links.
Notification links were broken before, giving
the reletive href. Now they'll work regardless
of where the user is at the time of the clicky-
click.
|
diff --git a/boost_info.gemspec b/boost_info.gemspec
index abc1234..def5678 100644
--- a/boost_info.gemspec
+++ b/boost_info.gemspec
@@ -17,6 +17,6 @@ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]
- spec.add_development_dependency "bundler", "~> 1.8"
+ spec.add_development_dependency "bundler", "~> 1.7"
spec.add_development_dependency "rake", "~> 10.0"
end
|
Downgrade bundler for Travis CI
|
diff --git a/lib/foot_stats/error_response.rb b/lib/foot_stats/error_response.rb
index abc1234..def5678 100644
--- a/lib/foot_stats/error_response.rb
+++ b/lib/foot_stats/error_response.rb
@@ -31,5 +31,15 @@ def each(&block)
[]
end
+
+ # <b>Respect the contract with the Resource Instance and Resource Collections.</b>
+ # This method is useful when you want to store the response in your database or
+ # log this in your own way.
+ #
+ # <b>I prefer to explicit this and explain, instead use the alias keyword in Ruby.</b>
+ #
+ def response
+ message
+ end
end
end
|
Add response convenient method to Error Response. Useful for store or logging the error response.
|
diff --git a/Casks/reflector.rb b/Casks/reflector.rb
index abc1234..def5678 100644
--- a/Casks/reflector.rb
+++ b/Casks/reflector.rb
@@ -1,6 +1,6 @@ cask :v1 => 'reflector' do
- version '2.1.0.0'
- sha256 'eda358fec24270e823bd46441ab39e434a616752cd0d5f02456871ee1f870af9'
+ version '2.2.0'
+ sha256 '2a35b89d7b5181c2a26c9f587b92e6ee9865facce869409aa81f471e2ae0d920'
url "http://download.airsquirrels.com/Reflector2/Mac/Reflector-#{version}.dmg"
appcast 'https://updates.airsquirrels.com/Reflector2/Mac/Reflector2.xml'
|
Upgrade Reflector.app to v 2.2.0
|
diff --git a/lib/futurocube/verify_command.rb b/lib/futurocube/verify_command.rb
index abc1234..def5678 100644
--- a/lib/futurocube/verify_command.rb
+++ b/lib/futurocube/verify_command.rb
@@ -9,8 +9,8 @@ def exec(file)
ResourceFile.open(file) do |rf|
expected = rf.header.checksum
- with_progress('Checking', rf.header.file_size) do |progress|
- actual = rf.compute_checksum do |done|
+ actual = with_progress('Checking', rf.header.file_size) do |progress|
+ rf.compute_checksum do |done|
progress.set(done)
end
end
|
Verify wasn't passing the hash back after refactoring with_progress
|
diff --git a/app/controllers/solidus_subscriptions/api/v1/line_items_controller.rb b/app/controllers/solidus_subscriptions/api/v1/line_items_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/solidus_subscriptions/api/v1/line_items_controller.rb
+++ b/app/controllers/solidus_subscriptions/api/v1/line_items_controller.rb
@@ -15,9 +15,7 @@
def line_item_params
params.require(:subscription_line_item).permit(
- :max_installments,
- :interval,
- :quantity
+ SolidusSubscriptions::Config.subscription_line_item_attributes - [:subscribable_id]
)
end
|
Use configurable strong params list
Instead of hard-coding these, use the global list in the config, minus
the subscribable_id, since we don't wish for users to be able to
completely swap out the basis of their subscription.
|
diff --git a/lib/money-rails/mongoid/three.rb b/lib/money-rails/mongoid/three.rb
index abc1234..def5678 100644
--- a/lib/money-rails/mongoid/three.rb
+++ b/lib/money-rails/mongoid/three.rb
@@ -28,7 +28,7 @@ when object.is_a?(Money) then object.mongoize
when object.is_a?(Hash) then
object.symbolize_keys!
- ::Money.new(object[:cents], object[:currency]).mongoize
+ ::Money.new(object[:cents], object[:currency_iso]).mongoize
when object.respond_to?(:to_money) then
object.to_money.mongoize
else object
|
Fix syntax error for mongoid extension
|
diff --git a/lib/phare/checks/ruby_rubocop.rb b/lib/phare/checks/ruby_rubocop.rb
index abc1234..def5678 100644
--- a/lib/phare/checks/ruby_rubocop.rb
+++ b/lib/phare/checks/ruby_rubocop.rb
@@ -4,7 +4,7 @@ attr_reader :status
def initialize
- @command = 'bundle exec rubocop'
+ @command = 'rubocop'
end
def run
|
Remove bundle exec from Rubocop check
|
diff --git a/library/rbconfig/unicode_spec.rb b/library/rbconfig/unicode_spec.rb
index abc1234..def5678 100644
--- a/library/rbconfig/unicode_spec.rb
+++ b/library/rbconfig/unicode_spec.rb
@@ -0,0 +1,34 @@+require_relative '../../spec_helper'
+require 'rbconfig'
+
+describe "RbConfig::CONFIG['UNICODE_VERSION']" do
+ ruby_version_is ""..."2.5" do
+ it "is 9.0.0 for Ruby 2.4" do
+ RbConfig::CONFIG['UNICODE_VERSION'].should == "9.0.0"
+ end
+ end
+
+ ruby_version_is "2.5"..."2.6" do
+ it "is 10.0.0 for Ruby 2.5" do
+ RbConfig::CONFIG['UNICODE_VERSION'].should == "10.0.0"
+ end
+ end
+
+ ruby_version_is "2.6"..."2.6.2" do
+ it "is 11.0.0 for Ruby 2.6.0 and 2.6.1" do
+ RbConfig::CONFIG['UNICODE_VERSION'].should == "11.0.0"
+ end
+ end
+
+ ruby_version_is "2.6.2"..."2.6.3" do
+ it "is 12.0.0 for Ruby 2.6.2" do
+ RbConfig::CONFIG['UNICODE_VERSION'].should == "12.0.0"
+ end
+ end
+
+ ruby_version_is "2.6.3" do
+ it "is 12.1.0 for Ruby 2.6.3+ and Ruby 2.7" do
+ RbConfig::CONFIG['UNICODE_VERSION'].should == "12.1.0"
+ end
+ end
+end
|
Add a spec for RbConfig::CONFIG['UNICODE_VERSION']
|
diff --git a/messagemedia.gemspec b/messagemedia.gemspec
index abc1234..def5678 100644
--- a/messagemedia.gemspec
+++ b/messagemedia.gemspec
@@ -10,7 +10,7 @@ spec.name = "messagemedia"
spec.version = Messagemedia::VERSION
spec.authors = ["Chris Hawkins", "Tristan Penman"]
- spec.email = ["chris.hawkins@outlook.com", "tristan@tristanpenman.com"]
+ spec.email = ["chris.hawkins@outlook.com", "tristan.penman@messagemedia.com.au"]
spec.summary = "Simple Ruby interface for the MessageMedia SOAP API"
spec.description = "Support for Ruby applications to integrate with the MessageMedia SOAP API"
spec.homepage = "http://www.messagemedia.com/"
|
Update author email address in gemspec file.
|
diff --git a/simple_webmon.gemspec b/simple_webmon.gemspec
index abc1234..def5678 100644
--- a/simple_webmon.gemspec
+++ b/simple_webmon.gemspec
@@ -8,8 +8,8 @@ spec.version = SimpleWebmon::VERSION
spec.authors = ["Mike Admire"]
spec.email = ["mike@mikeadmire.com"]
- spec.description = %q{TODO: Write a gem description}
- spec.summary = %q{TODO: Write a gem summary}
+ spec.description = %q{Easy way to setup basic website monitoring.}
+ spec.summary = %q{simple_webmon is a Ruby gem that makes it easy to setup a basic website monitor.}
spec.homepage = ""
spec.license = "MIT"
|
Add description and summary to gemspec.
|
diff --git a/files/lib/compat_resource/gemspec.rb b/files/lib/compat_resource/gemspec.rb
index abc1234..def5678 100644
--- a/files/lib/compat_resource/gemspec.rb
+++ b/files/lib/compat_resource/gemspec.rb
@@ -28,6 +28,6 @@ s.executables = []
s.require_path = "files/lib"
s.files = %w(LICENSE README.md CHANGELOG.md Gemfile Rakefile) +
- Dir.glob("#{s.full_gem_path}/files/{lib,spec}/**/*", File::FNM_DOTMATCH).reject {|f| File.directory?(f) }
+ Dir.glob("files/{lib,spec}/**/*", File::FNM_DOTMATCH).reject {|f| File.directory?(f) }
end
end
|
Remove absolute paths from the manifest
|
diff --git a/fluent-plugin-gcloud-storage.gemspec b/fluent-plugin-gcloud-storage.gemspec
index abc1234..def5678 100644
--- a/fluent-plugin-gcloud-storage.gemspec
+++ b/fluent-plugin-gcloud-storage.gemspec
@@ -18,6 +18,7 @@ spec.add_development_dependency 'bundler', '~> 1.10'
spec.add_development_dependency 'rake', '~> 10.0'
spec.add_development_dependency 'rspec'
+ spec.add_development_dependency 'test-unit'
spec.add_runtime_dependency 'fluentd', '> 0.10.42'
spec.add_runtime_dependency 'gcloud', '~> 0.4.0'
|
Add test-unit as development dependency
|
diff --git a/test/integration/configuration/serverspec/localhost/setup_spec.rb b/test/integration/configuration/serverspec/localhost/setup_spec.rb
index abc1234..def5678 100644
--- a/test/integration/configuration/serverspec/localhost/setup_spec.rb
+++ b/test/integration/configuration/serverspec/localhost/setup_spec.rb
@@ -34,11 +34,4 @@ it { should be_grouped_into('kafka') }
it { should be_mode 755 }
end
-
- describe file('/var/kafka') do
- it { should be_a_directory }
- it { should be_owned_by('kafka') }
- it { should be_grouped_into('kafka') }
- it { should be_mode 755 }
- end
end
|
Remove unnecessary integration test case
|
diff --git a/plugins/commands/destroy/command.rb b/plugins/commands/destroy/command.rb
index abc1234..def5678 100644
--- a/plugins/commands/destroy/command.rb
+++ b/plugins/commands/destroy/command.rb
@@ -18,6 +18,11 @@ o.on("-f", "--force", "Destroy without confirmation.") do |f|
options[:force] = f
end
+
+ o.on("--[no-]parallel",
+ "Enable or disable parallelism if provider supports it") do |p|
+ options[:parallel] = p
+ end
end
# Parse the options
@@ -25,25 +30,31 @@ return if !argv
@logger.debug("'Destroy' each target VM...")
- declined = 0
- total = 0
- with_target_vms(argv, reverse: true) do |vm|
- action_env = vm.action(
- :destroy, force_confirm_destroy: options[:force])
- total += 1
- declined += 1 if action_env.key?(:force_confirm_destroy_result) &&
- action_env[:force_confirm_destroy_result] == false
+ if options[:parallel]
+ options[:force] = true
end
- # Nothing was declined
- return 0 if declined == 0
+ machines = []
- # Everything was declined
- return 1 if declined == total
+ @env.batch(options[:parallel]) do |batch|
+ with_target_vms(argv, reverse: true) do |vm|
+ machines << vm
+ batch.action(vm, :destroy, force_confirm_destroy: options[:force])
+ end
+ end
- # Some was declined
- return 2
+ states = machines.map { |m| m.state.id }
+ if states.uniq.length == 1 && states.first == :not_created
+ # Nothing was declined
+ return 0
+ elsif states.uniq.length == 1 && states.first != :not_created
+ # Everything was declined
+ return 1
+ else
+ # Some was declined
+ return 2
+ end
end
end
end
|
Introduce parallel destroy for certain providers
This commit introduces parallel destroy using the batch action class for
the destroy command.
|
diff --git a/WebKitPlus.podspec b/WebKitPlus.podspec
index abc1234..def5678 100644
--- a/WebKitPlus.podspec
+++ b/WebKitPlus.podspec
@@ -11,7 +11,7 @@ s.homepage = "https://github.com/yashigani/WebKitPlus"
s.license = { :type => "MIT", :file => "LICENSE" }
- s.ios.deployment_target = "8.0"
+ s.ios.deployment_target = "12.0"
s.framework = "WebKit"
s.source = { :git => "https://github.com/yashigani/WebKitPlus.git", :tag => "#{s.version}" }
|
Update iOS deployment target in podspec
|
diff --git a/plugins/kernel_v1/config/vagrant.rb b/plugins/kernel_v1/config/vagrant.rb
index abc1234..def5678 100644
--- a/plugins/kernel_v1/config/vagrant.rb
+++ b/plugins/kernel_v1/config/vagrant.rb
@@ -11,10 +11,20 @@ @host = UNSET_VALUE
end
+ def finalize!
+ @dotfile_name = nil if @dotfile_name == UNSET_VALUE
+ @host = nil if @host == UNSET_VALUE
+ end
+
def upgrade(new)
- new.vagrant.host = @host if @host != UNSET_VALUE
+ new.vagrant.host = @host if @host.nil?
- # TODO: Warn that "dotfile_name" is gone in V2
+ warnings = []
+ if @dotfile_name
+ warnings << "`config.vm.dotfile_name` has no effect anymore."
+ end
+
+ [warnings, []]
end
end
end
|
Add a warning if dotfile_name is used in V1
|
diff --git a/lib/tasks/deployment/20181031104615_remove_path_from_archived_procedures.rake b/lib/tasks/deployment/20181031104615_remove_path_from_archived_procedures.rake
index abc1234..def5678 100644
--- a/lib/tasks/deployment/20181031104615_remove_path_from_archived_procedures.rake
+++ b/lib/tasks/deployment/20181031104615_remove_path_from_archived_procedures.rake
@@ -0,0 +1,8 @@+namespace :after_party do
+ desc 'Deployment task: remove_path_from_archived_procedures'
+ task remove_path_from_archived_procedures: :environment do
+ Procedure.archivees.where.not(path: nil).update_all(path: nil)
+
+ AfterParty::TaskRecord.create version: '20181031104615'
+ end
+end
|
Remove path from archived procedures
|
diff --git a/test/support/appearance_assertion.rb b/test/support/appearance_assertion.rb
index abc1234..def5678 100644
--- a/test/support/appearance_assertion.rb
+++ b/test/support/appearance_assertion.rb
@@ -5,6 +5,7 @@ module MiniTest
module Assertions
def assert_same_image(expected_image_path, output_image, delta = 0.0)
+ return if ENV['SKIP_CHECK']
# not supported yet
return if RUBY_PLATFORM == 'java'
return if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.4.0')
|
Test: Add envrionment variable to skip checking difference
|
diff --git a/spec/models/jar.rb b/spec/models/jar.rb
index abc1234..def5678 100644
--- a/spec/models/jar.rb
+++ b/spec/models/jar.rb
@@ -1,5 +1,5 @@ class Jar
include Mongoid::Document
- identity type: Integer
+ identity :type => Integer
has_many :cookies, :class_name => "Cookie"
end
|
Fix 1.8.x syntax error in spec models
|
diff --git a/spec/roomy_spec.rb b/spec/roomy_spec.rb
index abc1234..def5678 100644
--- a/spec/roomy_spec.rb
+++ b/spec/roomy_spec.rb
@@ -5,7 +5,7 @@ expect(Roomy::VERSION).not_to be nil
end
- it 'does something useful' do
+ xit 'does something useful' do
expect(false).to eq(true)
end
end
|
Mark the failing (boilerplate) test as pending
|
diff --git a/spec/pages/manual_page_spec.rb b/spec/pages/manual_page_spec.rb
index abc1234..def5678 100644
--- a/spec/pages/manual_page_spec.rb
+++ b/spec/pages/manual_page_spec.rb
@@ -32,7 +32,8 @@ source/manual/howto-merge-a-pull-request-from-an-external-contributor.html.md
])
it "doesn't use H1 tags (the page title is already an H1)" do
- expect(raw).not_to match(/\n#\s/)
+ expect(raw).not_to match(/\n#\s/), "This page contains an unnecessary H1." \
+ " This may have been triggered because of a # comment in a code block"
end
end
end
|
Add failing test hint for unnecessary H1
Although the tests check for the presence of a H1 (#) on the page, the
presence of a comment in a code block also triggers a failure. This
isn't easily fixable without a markdown AST.
This PR adds a hint as to a possible cause, to avoid confusion when this
edge case occurs and fixes #933
|
diff --git a/spec/features/user_feature.spec.rb b/spec/features/user_feature.spec.rb
index abc1234..def5678 100644
--- a/spec/features/user_feature.spec.rb
+++ b/spec/features/user_feature.spec.rb
@@ -0,0 +1,18 @@+require 'rails_helper'
+
+describe 'feature testing', :type => :feature do
+
+ feature 'the home page' do
+
+ scenario 'a user can see a register link' do
+ visit('/home')
+ expect(page).to have_link "Register"
+ end
+
+ scenario 'a user can redirect to the registration page' do
+ visit('/home')
+ click_link 'Register'
+ expect(page).to have_content "Please choose what type of user you are"
+ end
+ end
+end
|
Add feature testing for homepage
|
diff --git a/src/helpers/loader.rb b/src/helpers/loader.rb
index abc1234..def5678 100644
--- a/src/helpers/loader.rb
+++ b/src/helpers/loader.rb
@@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and
# limitations under the License.
require 'bundler'
+
Bundler.require(:default)
Bundler.require((ENV['RACK_ENV'] || :development).to_sym)
@@ -25,13 +26,6 @@ ActiveSupport::Dependencies.autoload_paths << File.expand_path(path, File.dirname(__FILE__))
end
-require 'sinatra'
-require 'sinatra/json'
-require 'sinatra/reloader'
-require 'sinatra/namespace'
-
-require 'action_controller'
-
# Load config
CloudConductor::Config.from_file File.expand_path('../../config/config.rb', File.dirname(__FILE__))
|
Remove already loaded gems by Bundler
|
diff --git a/resources/files/irbrc_predefiner.rb b/resources/files/irbrc_predefiner.rb
index abc1234..def5678 100644
--- a/resources/files/irbrc_predefiner.rb
+++ b/resources/files/irbrc_predefiner.rb
@@ -19,9 +19,3 @@ File.write(history_file, hist)
end
end
-
-# Fix IRB input text encoding when ruby is running with UTF-8 external encoding
-if Encoding.default_external == Encoding::UTF_8
- # Use dummy land "CCC" to switch input encoding to UTF-8 (C.UTF-8 is not recognized)
- ENV["LANG"] = "CCC.UTF-8"
-end
|
Remove workaround for UTF-8 issue in Reline
This has been fixed in commit
https://github.com/ruby/ruby/commit/f8ea2860b0cac1aec79978e6c44168802958e8af
|
diff --git a/test/functional/page_controller_test.rb b/test/functional/page_controller_test.rb
index abc1234..def5678 100644
--- a/test/functional/page_controller_test.rb
+++ b/test/functional/page_controller_test.rb
@@ -3,13 +3,13 @@ class PageControllerTest < ActionController::TestCase
context 'on GET to :index' do
setup do
- Factory(:project, :approved => true)
+ Factory(:active_project)
Factory(:user)
get :index
end
should_render_template :index
- should_assign_to :featured_project
+ should_assign_to :featured_project
should_assign_to :featured_volunteer
end
|
Fix broken PageController tests by using the new active_project factory.
|
diff --git a/test/helpers/application_helper_test.rb b/test/helpers/application_helper_test.rb
index abc1234..def5678 100644
--- a/test/helpers/application_helper_test.rb
+++ b/test/helpers/application_helper_test.rb
@@ -0,0 +1,8 @@+require 'test_helper'
+
+class ApplicationHelperTest < ActionView::TestCase
+ test "full title helper" do
+ assert_equal full_title, 'Ruby on Rails Tutorial Sample App'
+ assert_equal full_title("Help"), 'Help | Ruby on Rails Tutorial Sample App'
+ end
+end
|
Create the unit test of application helper
|
diff --git a/lib/awestruct/extensions/atomizer.rb b/lib/awestruct/extensions/atomizer.rb
index abc1234..def5678 100644
--- a/lib/awestruct/extensions/atomizer.rb
+++ b/lib/awestruct/extensions/atomizer.rb
@@ -2,8 +2,8 @@ module Extensions
class Atomizer
- def initialize(entries_name, output_path, opts={})
- @entries_name = entries_name
+ def initialize(entries, output_path, opts={})
+ @entries = entries
@output_path = output_path
@num_entries = opts[:num_entries] || 50
@content_url = opts[:content_url]
@@ -11,7 +11,7 @@ end
def execute(site)
- entries = site.send( @entries_name ) || []
+ entries = @entries.is_a?(Array) ? @entries : site.send( @entries ) || []
unless ( @num_entries == :all )
entries = entries[0, @num_entries]
end
|
Allow to specify the entries directly as an Array instead of reading them from site
|
diff --git a/test/unit/models/location_error_test.rb b/test/unit/models/location_error_test.rb
index abc1234..def5678 100644
--- a/test/unit/models/location_error_test.rb
+++ b/test/unit/models/location_error_test.rb
@@ -1,7 +1,7 @@ class LocationErrorTest < ActiveSupport::TestCase
context '#initialize' do
should 'default to default message when no message given' do
- error = LocationError.new(postcode_error = 'some_error')
+ error = LocationError.new('some_error')
assert_equal(error.message, 'formats.local_transaction.invalid_postcode')
end
@@ -9,7 +9,7 @@ should 'send the postcode error as a notification' do
ActiveSupport::Notifications.expects(:instrument).with('postcode_error_notification', postcode_error: "some_error")
- error = LocationError.new(postcode_error = 'some_error')
+ LocationError.new('some_error')
end
end
@@ -17,7 +17,7 @@ should 'not send a postcode_error notification' do
ActiveSupport::Notifications.expects(:instrument).never
- error = LocationError.new
+ LocationError.new
end
end
|
Fix outstanding UselessAssignment lint offenses
|
diff --git a/Casks/revisions-beta.rb b/Casks/revisions-beta.rb
index abc1234..def5678 100644
--- a/Casks/revisions-beta.rb
+++ b/Casks/revisions-beta.rb
@@ -0,0 +1,11 @@+cask :v1 => 'revisions-beta' do
+ version '2.1-r928'
+ sha256 'fb91a2dd876becd034445813bac037cf99cb4f3691f2d140c6425fe52427789f'
+
+ url "https://revisionsapp.com/downloads/revisions-#{version}-public-beta.dmg"
+ name 'Revisions'
+ homepage 'https://revisionsapp.com/'
+ license :commercial
+
+ app 'Revisions.app'
+end
|
Add Revisions beta version 2.1
This commit adds a new cask for the Revisions app. I haven't included
a comment to say where the download link was obtained as it is from a
public page on the vendor site: https://www.revisionsapp.com/releases
|
diff --git a/db/migrate/20151126050103_add_gateway_profile_ids_to_spree_konbinis.rb b/db/migrate/20151126050103_add_gateway_profile_ids_to_spree_konbinis.rb
index abc1234..def5678 100644
--- a/db/migrate/20151126050103_add_gateway_profile_ids_to_spree_konbinis.rb
+++ b/db/migrate/20151126050103_add_gateway_profile_ids_to_spree_konbinis.rb
@@ -0,0 +1,6 @@+class AddGatewayProfileIdsToSpreeKonbinis < ActiveRecord::Migration
+ def change
+ add_column :spree_konbinis, :gateway_customer_profile_id, :string
+ add_column :spree_konbinis, :gateway_payment_profile_id, :string
+ end
+end
|
Add missing columns to Spree::Konbini
We're not using these but they are expected on credit cards, so better
to have them.
|
diff --git a/lib/facter/rabbitmq_erlang_cookie.rb b/lib/facter/rabbitmq_erlang_cookie.rb
index abc1234..def5678 100644
--- a/lib/facter/rabbitmq_erlang_cookie.rb
+++ b/lib/facter/rabbitmq_erlang_cookie.rb
@@ -6,9 +6,11 @@ Facter.add(:rabbitmq_erlang_cookie) do
confine :osfamily => %w[Debian RedHat Suse]
- case Facter.value(:osfamily)
- when 'Debian', 'RedHat', 'Suse'
- cookie = File.read('/var/lib/rabbitmq/.erlang.cookie')
+ setcode do
+ if File.exists?('/var/lib/rabbitmq/.erlang.cookie')
+ File.read('/var/lib/rabbitmq/.erlang.cookie')
+ else
+ nil
+ end
end
- cookie
end
|
Fix the wrapping around this fact.
Embarrassing this fact was completely broken, but because the spec tests
fake out the results of the fact it wasn't being picked up.
|
diff --git a/spec/tic_tac_toe/view/board_spec.rb b/spec/tic_tac_toe/view/board_spec.rb
index abc1234..def5678 100644
--- a/spec/tic_tac_toe/view/board_spec.rb
+++ b/spec/tic_tac_toe/view/board_spec.rb
@@ -0,0 +1,18 @@+require 'spec_helper'
+require 'tic_tac_toe/view/board'
+
+describe TicTacToe::View::Board do
+
+ it 'Properly denotes row starts and ends' do
+ bv = TicTacToe::View::Board.new(TicTacToe::Board.empty_board)
+ starts = (0...9).map { |i| bv.is_row_start?(i) }
+ ends = (0...9).map { |i| bv.is_row_end?(i) }
+ expect(starts).to eq([true, false, false,
+ true, false, false,
+ true, false, false])
+ expect(ends).to eq([false, false, true,
+ false, false, true,
+ false, false, true])
+ end
+
+end
|
Add a board view test for the start and end logic of rows
|
diff --git a/spec/unit/rom/session/state_spec.rb b/spec/unit/rom/session/state_spec.rb
index abc1234..def5678 100644
--- a/spec/unit/rom/session/state_spec.rb
+++ b/spec/unit/rom/session/state_spec.rb
@@ -0,0 +1,77 @@+require 'spec_helper'
+
+describe Session::State do
+ fake(:object)
+ fake(:mapper)
+ fake(:relation)
+
+ describe '#transient?' do
+ context 'with transient state' do
+ subject { Session::State::Transient.new(object) }
+
+ it { should be_transient }
+ end
+
+ context 'with a non-transient state' do
+ subject { Session::State::Persisted.new(object, mapper) }
+
+ it { should_not be_transient }
+ end
+ end
+
+ describe '#persisted?' do
+ context 'with a persisted state' do
+ subject { Session::State::Persisted.new(object, mapper) }
+
+ it { should be_persisted }
+ end
+
+ context 'with a non-persisted state' do
+ subject { Session::State::Transient.new(object) }
+
+ it { should_not be_persisted }
+ end
+ end
+
+ describe '#created?' do
+ context 'with a created state' do
+ subject { Session::State::Created.new(object, relation) }
+
+ it { should be_created }
+ end
+
+ context 'with a non-created state' do
+ subject { Session::State::Transient.new(object) }
+
+ it { should_not be_created }
+ end
+ end
+
+ describe '#updated?' do
+ context 'with an updated state' do
+ subject { Session::State::Updated.new(object, relation) }
+
+ it { should be_updated }
+ end
+
+ context 'with a non-updated state' do
+ subject { Session::State::Transient.new(object) }
+
+ it { should_not be_updated }
+ end
+ end
+
+ describe '#deleted?' do
+ context 'with a deleted state' do
+ subject { Session::State::Deleted.new(object, relation) }
+
+ it { should be_deleted }
+ end
+
+ context 'with a non-updated state' do
+ subject { Session::State::Transient.new(object) }
+
+ it { should_not be_deleted }
+ end
+ end
+end
|
Add specs for state predicate methods
|
diff --git a/lib/project/rumo_text/type_helper.rb b/lib/project/rumo_text/type_helper.rb
index abc1234..def5678 100644
--- a/lib/project/rumo_text/type_helper.rb
+++ b/lib/project/rumo_text/type_helper.rb
@@ -19,8 +19,8 @@ end
def size
- size_ptr = Pointer.new('I')
- align_ptr = Pointer.new('I')
+ size_ptr = Pointer.new('Q')
+ align_ptr = Pointer.new('Q')
NSGetSizeAndAlignment(type, size_ptr, align_ptr)
size_ptr.value
end
|
Fix to be able to use RubyMotion 3.0
|
diff --git a/lib/rails_database_yml/capistrano.rb b/lib/rails_database_yml/capistrano.rb
index abc1234..def5678 100644
--- a/lib/rails_database_yml/capistrano.rb
+++ b/lib/rails_database_yml/capistrano.rb
@@ -26,5 +26,5 @@ end
end
after "deploy:setup", "rails_database:setup"
- after "deploy:update_code", "rails_database:symlink"
+ before "deploy:finalize_update", "rails_database:symlink"
end
|
Create the symlink before "deploy:finalize_update".
Fix a regression with Rails 3.1 applications.
Precompiling the asset pipeline needs a correct config/database.yml file.
|
diff --git a/lib/rmuh/serverstats/operationarrowhead.rb b/lib/rmuh/serverstats/operationarrowhead.rb
index abc1234..def5678 100644
--- a/lib/rmuh/serverstats/operationarrowhead.rb
+++ b/lib/rmuh/serverstats/operationarrowhead.rb
@@ -0,0 +1,16 @@+# -*- coding: UTF-8 -*-
+
+require 'rmuh/serverstats/base'
+
+module RMuh
+ module ServerStats
+ # TODO: Documentation
+ #
+ class OperationArrowhead < RMuh::ServerStats::Base
+ def method_missing(method, *args, &block)
+ m = /(.*)/.match(method)[0]
+ stats[m]
+ end
+ end
+ end
+end
|
Add new OperationArrowhead server stats
Really, this just extends the Base class with some method_missing magic.
|
diff --git a/lib/thinreports/core/shape/basic/format.rb b/lib/thinreports/core/shape/basic/format.rb
index abc1234..def5678 100644
--- a/lib/thinreports/core/shape/basic/format.rb
+++ b/lib/thinreports/core/shape/basic/format.rb
@@ -10,6 +10,11 @@ config_reader :type, :id
config_reader :style
config_checker true, :display
+ config_reader follow_stretch: %w[follow-stretch]
+
+ def affect_bottom_margin?
+ attributes.fetch('affect-bottom-margin', true)
+ end
end
end
end
|
Add some properties to all items
- affect-bottom-margin
- follow-stretch
Co-authored-by: kosappi <1a72c3adb8cf451abd36cfcfa35039fbab5efb3b@misoca.jp>
Co-authored-by: Katsuya HIDAKA <2f1e5d0fd7c5b5529f5d591c063df911b29bc9d1@gmail.com>
|
diff --git a/lib/blueberry_cms/liquid_tags/page_link.rb b/lib/blueberry_cms/liquid_tags/page_link.rb
index abc1234..def5678 100644
--- a/lib/blueberry_cms/liquid_tags/page_link.rb
+++ b/lib/blueberry_cms/liquid_tags/page_link.rb
@@ -9,7 +9,9 @@
def render(context)
page = Page.find(@options[:id])
- context['h'].link_to @options[:title].presence || page.name, page.to_path
+ context['h'].link_to(@options[:title].presence || page.name,
+ page.to_path,
+ class: @options[:class].presence)
end
end
|
Add CSS class to Page link drop
|
diff --git a/lib/redis/objects/connection_pool_proxy.rb b/lib/redis/objects/connection_pool_proxy.rb
index abc1234..def5678 100644
--- a/lib/redis/objects/connection_pool_proxy.rb
+++ b/lib/redis/objects/connection_pool_proxy.rb
@@ -9,6 +9,7 @@ def method_missing(name, *args, &block)
@pool.with { |x| x.send(name, *args, &block) }
end
+ ruby2_keywords :method_missing if respond_to?(:ruby2_keywords, true)
def respond_to_missing?(name, include_all = false)
@pool.with { |x| x.respond_to?(name, include_all) }
|
Fix ConnectionPoolProxy Ruby 3.0 compatibility
Fix: https://github.com/nateware/redis-objects/pull/258
|
diff --git a/lib/rspec/json_matcher/abstract_matcher.rb b/lib/rspec/json_matcher/abstract_matcher.rb
index abc1234..def5678 100644
--- a/lib/rspec/json_matcher/abstract_matcher.rb
+++ b/lib/rspec/json_matcher/abstract_matcher.rb
@@ -27,7 +27,7 @@ "be JSON"
end
- def failure_message_for_should
+ def failure_message
if has_parser_error?
"expected value to be parsed as JSON, but failed"
else
@@ -35,7 +35,7 @@ end
end
- def failure_message_for_should_not
+ def failure_message_when_negated
if has_parser_error?
"expected value not to be parsed as JSON, but succeeded"
else
|
Fix deprecation warnings: use new protocols for rspec 3
|
diff --git a/lib/ebay/types/product_sort_code.rb b/lib/ebay/types/product_sort_code.rb
index abc1234..def5678 100644
--- a/lib/ebay/types/product_sort_code.rb
+++ b/lib/ebay/types/product_sort_code.rb
@@ -3,7 +3,6 @@ class ProductSortCode
extend Enumerable
extend Enumeration
- PopularityAsc = 'PopularityAsc'
PopularityAsc = 'PopularityAsc'
PopularityDesc = 'PopularityDesc'
RatingAsc = 'RatingAsc'
|
Remove duplicate definition of PopularityAsc
Which resulted in warnings displayed whenever the library is required.
The reason it is appearing twice is that because it is defined twice in
ebaySvc.xsd (schema) file and class generator doesn't check uniqueness
of enumerable values.
Perhaps eBay going to remove it from future schema, since it says:
> This field is deprecated (in first definition)
> This value is not used (in second definition)
The following command can be used to quickly find those definitions:
> ack 'PopularityAsc' -C 6 lib/ebay/schema/ebaySvc.xsd
|
diff --git a/lib/loader/vertica/vertica_utils.rb b/lib/loader/vertica/vertica_utils.rb
index abc1234..def5678 100644
--- a/lib/loader/vertica/vertica_utils.rb
+++ b/lib/loader/vertica/vertica_utils.rb
@@ -0,0 +1,61 @@+module Myreplicator
+ class VerticaUtils
+ class << self
+ # Example: get_grant({:db => "bidw", :schema => "king", :table => "customer"})
+ def get_grants *args
+ options = args.extract_options!
+ db = options[:db]
+ schema = options[:schema]
+ table = options[:table]
+ sql = "SELECT * FROM grants WHERE object_schema = '#{schema}' AND object_name = '#{table}';"
+ result = Myreplicator::DB.exec_sql("vertica",sql)
+ sqls = []
+ result.entries.each do |priv|
+ privilege = priv[:privileges_description]
+ grantee = priv[:grantee]
+ begin
+ sql = "GRANT #{privilege} ON #{schema}.#{table} TO #{grantee};"
+ sqls << sql
+ puts sql
+ rescue Exception => e
+ puts e.message
+ end
+ end
+ return sqls
+ end
+
+ # Example: set_grants sqls
+ def set_grants sqls
+ sqls.each do |sql|
+ begin
+ puts sql
+ Myreplicator::DB.exec_sql("vertica",sql)
+ rescue Exception => e
+ puts e.message
+ end
+ end
+ end
+
+ # Example: save_grants_to_file({:sqls => ["GRANT ..","GRANT ..."], :file=>"grants.txt"})
+ def save_grants_to_file *args
+ options = args.extract_options!
+ sqls = options[:sqls]
+ filename = Rails.root.join('tmp', options[:file])
+ file = File.open(filename, "w+")
+ sqls.each do |sql|
+ file.puts sql.to_s
+ end
+ file.close()
+ end
+
+ def load_grants_from_file f
+ file = Rails.root.join('tmp', f)
+ file = File.open(filename, "r")
+ sqls = file.readlines
+ file.close()
+ return sqls
+ end
+
+ end #end class << self
+ end
+end
|
Add GRANT utils to Myreplicator to use in dropping a table and then re-grant the permission on that table
|
diff --git a/lib/rrj/janus/responses/standard.rb b/lib/rrj/janus/responses/standard.rb
index abc1234..def5678 100644
--- a/lib/rrj/janus/responses/standard.rb
+++ b/lib/rrj/janus/responses/standard.rb
@@ -11,9 +11,17 @@ data_id
end
+ def session_id
+ request['session_id']
+ end
+
# Return a integer to handle
def sender
data_id
+ end
+
+ def handle_id
+ request['sender']
end
# Read response for plugin request
|
Add method for extracting session_id/handle_id
|
diff --git a/lib/suspect/file_tree/git/client.rb b/lib/suspect/file_tree/git/client.rb
index abc1234..def5678 100644
--- a/lib/suspect/file_tree/git/client.rb
+++ b/lib/suspect/file_tree/git/client.rb
@@ -3,7 +3,7 @@ module Git
class Client
def modified_files
- `git ls-files --modified`
+ `git ls-files --modified --full-name`
end
def commit_hash
|
Add --full-name option to git ls-files command
The option was added "just in case".
|
diff --git a/spec/controllers/info_boxes_controller_spec.rb b/spec/controllers/info_boxes_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/info_boxes_controller_spec.rb
+++ b/spec/controllers/info_boxes_controller_spec.rb
@@ -4,9 +4,6 @@
RSpec.describe InfoBoxesController, type: :controller do
describe 'GET #index' do
- it 'returns http success' do
- get :index
- expect(response).to have_http_status(:success)
- end
+ xit 'Should create tests for this.'
end
end
|
Fix failing test that seem to require auth
|
diff --git a/spec/dummy/config/initializers/secret_token.rb b/spec/dummy/config/initializers/secret_token.rb
index abc1234..def5678 100644
--- a/spec/dummy/config/initializers/secret_token.rb
+++ b/spec/dummy/config/initializers/secret_token.rb
@@ -0,0 +1,12 @@+# Be sure to restart your server when you modify this file.
+
+# Your secret key is used for verifying the integrity of signed cookies.
+# 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.
+# You can use `rake secret` to generate a secure secret key.
+
+# Make sure your secret_key_base is kept private
+# if you're sharing your code publicly.
+Dummy::Application.config.secret_key_base = 'c9832b214b2e489d79731521da928724c08c03575b93b6f871b339fd047b0d69b84dfcab15ea1b7c94ad1d34284d333d19690a45b7a60a7d297d47edcf816de0'
|
Add secret token to dummy app
|
diff --git a/lib/gitlab/background_migration/migrate_build_stage_id_reference.rb b/lib/gitlab/background_migration/migrate_build_stage_id_reference.rb
index abc1234..def5678 100644
--- a/lib/gitlab/background_migration/migrate_build_stage_id_reference.rb
+++ b/lib/gitlab/background_migration/migrate_build_stage_id_reference.rb
@@ -2,7 +2,7 @@ module BackgroundMigration
class MigrateBuildStageIdReference
def perform(id)
- raise ArgumentError unless id.is_a?(Integer)
+ raise ArgumentError unless id.present?
sql = <<-SQL.strip_heredoc
UPDATE "ci_builds" SET "stage_id" = (
|
Test if argument passed to a migration is present
|
diff --git a/app/cells/plugins/core/tree_cell.rb b/app/cells/plugins/core/tree_cell.rb
index abc1234..def5678 100644
--- a/app/cells/plugins/core/tree_cell.rb
+++ b/app/cells/plugins/core/tree_cell.rb
@@ -20,9 +20,13 @@ end
def metadata_values
+ values = [["-- Select an Option --", nil]]
+
@options[:metadata]["data"]["tree_array"].map do |value|
- [value["node"]["name"], value["id"]]
+ values << [value["node"]["name"], value["id"]]
end
+
+ values
end
end
end
|
Add Default Nil Values for all Dropdowns
|
diff --git a/app/concerns/couriers/fusionable.rb b/app/concerns/couriers/fusionable.rb
index abc1234..def5678 100644
--- a/app/concerns/couriers/fusionable.rb
+++ b/app/concerns/couriers/fusionable.rb
@@ -35,7 +35,6 @@
table.select("ROWID", "WHERE name='#{photo.key}'").map(&:values).map(&:first).map { |id| table.delete id }
table.insert [photo.to_fusion]
- sleep 1
end
end
end
|
Remove sleep from Fusion Tables
|
diff --git a/app/controllers/claim_controller.rb b/app/controllers/claim_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/claim_controller.rb
+++ b/app/controllers/claim_controller.rb
@@ -4,7 +4,8 @@
def index
if Mockr.unclaimed? && viewer.authenticated?
- owner = User.create(:facebook_uid => viewer.facebook_uid, :name => cookies["fbname"])
+ owner = User.create(:facebook_uid => viewer.facebook_uid,
+ :name => "Jacob")
flash[:notice] = "Congratulations #{owner.first_name}, you're now the proud owner of this brand new instance of Mockr!"
redirect_to root_path
else
|
Standardize on a default name that doesn't depend on a Facebook cookie.
Change-Id: Ie20a5957809fbf8ed56cf943e2fa1959634a2e9b
Reviewed-on: https://gerrit.causes.com/5045
Reviewed-by: Chris Chan <711c73f64afdce07b7e38039a96d2224209e9a6c@causes.com>
Tested-by: Chris Chan <711c73f64afdce07b7e38039a96d2224209e9a6c@causes.com>
|
diff --git a/app/controllers/dojos_controller.rb b/app/controllers/dojos_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/dojos_controller.rb
+++ b/app/controllers/dojos_controller.rb
@@ -6,8 +6,8 @@ url: dojo.url,
name: dojo.name,
order: dojo.order,
- prefecture: dojo.prefecture.region,
- linked_text: "<a href='#{dojo.url}'>#{dojo.name}</a>(#{dojo.prefecture.region})",
+ prefecture: dojo.prefecture.name,
+ linked_text: "<a href='#{dojo.url}'>#{dojo.name}</a>(#{dojo.prefecture.name})",
}
end
|
Return prefecture name instead of region name
|
diff --git a/app/controllers/repos_controller.rb b/app/controllers/repos_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/repos_controller.rb
+++ b/app/controllers/repos_controller.rb
@@ -1,5 +1,5 @@ class ReposController < ApplicationController
- # before_filter :fetch_email_address, only: [:index]
+ before_filter :fetch_email_address, only: [:index]
respond_to :json
|
Revert "Don't fetch emails until migration has run"
This reverts commit e073c655a694e13adb670961af12c8157a458577.
|
diff --git a/app/controllers/tests_controller.rb b/app/controllers/tests_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/tests_controller.rb
+++ b/app/controllers/tests_controller.rb
@@ -10,10 +10,7 @@ Rails.cache.clear
DatabaseCleaner.strategy = :truncation
DatabaseCleaner.clean
-
- respond_to do |format|
- format.json { render json: {}, status: :ok }
- end
+ respond_with_json
end
end
end
|
Use respond_with_json on tests controller
|
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
@@ -7,8 +7,10 @@
def show
@user = User.find(params[:id])
+ if current_user
@connection = Connection.find_by(initializer_id:current_user.id, receiver_id: @user.id) || @connection = Connection.find_by(initializer_id:@user.id, receiver_id: current_user.id)
@connections = @user.initializer_connections + @user.receiver_connections
+ end
end
def edit
|
Add check to see if user is signed in
|
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
@@ -6,7 +6,7 @@
def show
@user = User.find(params[:id])
- @documents = @user.documents
+ @documents = @user.documents.order("created_at DESC")
unless @user == current_user
redirect_to root_path
|
Order documents in descending order
|
diff --git a/app/models/collaborator_importer.rb b/app/models/collaborator_importer.rb
index abc1234..def5678 100644
--- a/app/models/collaborator_importer.rb
+++ b/app/models/collaborator_importer.rb
@@ -0,0 +1,101 @@+class CollaboratorImporter
+ ACCEPT_CONTENT_TYPE = 'text/plain'
+ LINE_FORMAT = /\A\d{4}\s+\d{4}\s+\w.*\z/
+
+ include ActiveModel::Conversion
+ include ActiveModel::Validations
+
+ attr_reader :file, :total_created, :total_updated
+ validates_presence_of :file
+ validate :require_uploaded_file
+ validate :require_text_content_type
+
+ def persisted?
+ false
+ end
+
+ # Example file structure, remember we are always dealing with questor_id.
+ # Comp / Collab / Name
+ # 0001 0002 COLLABORATOR NAME
+ def save
+ valid? && process!
+ end
+
+ def warnings
+ @warnings ||= ActiveModel::Errors.new(self)
+ end
+
+ private
+
+ def initialize(attributes={})
+ @file = attributes[:file] if attributes
+ @companies = {}
+ reset_totals
+ end
+
+ def require_uploaded_file
+ errors.add(:file, :invalid) unless file.respond_to?(:tempfile)
+ end
+
+ def require_text_content_type
+ errors.add(:file, :invalid) unless file.respond_to?(:content_type) &&
+ file.content_type == ACCEPT_CONTENT_TYPE
+ end
+
+ def process!
+ Collaborator.transaction do
+ # Force encoding to iso8859-1 to work with windows generated files and
+ # accented chars.
+ lines = @file.tempfile.read
+ lines.force_encoding("iso8859-1") if lines.respond_to?(:force_encoding)
+ lines.each_line do |line|
+ process_line(line) if valid_line?(line)
+ end
+
+ true
+ end
+ end
+
+ def valid_line?(line)
+ line.present? && line.chomp =~ LINE_FORMAT
+ end
+
+ def process_line(line)
+ company_id, collaborator_id, *collaborator_name = line.split
+ company = find_company(company_id) or (add_company_not_found_warning(company_id) and return)
+ collaborator = find_collaborator(company, collaborator_id)
+
+ update_totals(collaborator)
+ collaborator_name = convert_collaborator_name(collaborator_name.join(' '))
+
+ collaborator.update_attributes(:name => collaborator_name)
+ end
+
+ def convert_collaborator_name(collaborator_name)
+ collaborator_name.encode('utf-8')
+ end
+
+ def find_company(id)
+ @companies[id] ||= Company.find_by_questor_id(id)
+ end
+
+ def find_collaborator(company, id)
+ company.collaborators.find_or_initialize_by_questor_id(id)
+ end
+
+ def reset_totals
+ @total_created = @total_updated = 0
+ end
+
+ def update_totals(collaborator)
+ if collaborator.persisted?
+ @total_updated += 1
+ else
+ @total_created += 1
+ end
+ end
+
+ def add_company_not_found_warning(company_id)
+ warnings.add(:base, :company_not_found, :company_id => company_id)
+ end
+end
|
Add another not used file for tests
|
diff --git a/app/models/cost_calculation_type.rb b/app/models/cost_calculation_type.rb
index abc1234..def5678 100644
--- a/app/models/cost_calculation_type.rb
+++ b/app/models/cost_calculation_type.rb
@@ -1,10 +1,5 @@ class CostCalculationType < ActiveRecord::Base
-
- # associations
- has_many :policys
-
- #attr_accessible :name, :description, :class_name, :active
-
+
# default scope
default_scope { where(:active => true) }
|
Remove association from lookup table
|
diff --git a/app/models/manual_with_documents.rb b/app/models/manual_with_documents.rb
index abc1234..def5678 100644
--- a/app/models/manual_with_documents.rb
+++ b/app/models/manual_with_documents.rb
@@ -1,10 +1,10 @@ require "delegate"
class ManualWithDocuments < SimpleDelegator
- def initialize(document_builder, manual, attrs)
+ def initialize(document_builder, manual, documents:, removed_documents: [])
@manual = manual
- @documents = attrs.fetch(:documents)
- @removed_documents = attrs.fetch(:removed_documents, [])
+ @documents = documents
+ @removed_documents = removed_documents
@document_builder = document_builder
super(manual)
end
|
Use Ruby keyword args in ManualWithDocuments
I think that using language features instead of custom code makes this
easier to understand.
|
diff --git a/HTDelegateProxy.podspec b/HTDelegateProxy.podspec
index abc1234..def5678 100644
--- a/HTDelegateProxy.podspec
+++ b/HTDelegateProxy.podspec
@@ -1,6 +1,6 @@ Pod::Spec.new do |s|
s.name = "HTDelegateProxy"
- s.version = "0.0.1"
+ s.version = "0.0.2"
s.summary = "A class that allows you to assign multiple delegates."
s.homepage = "https://github.com/hoteltonight/HTDelegateProxy"
s.license = 'MIT'
|
Update podspec, change tag to 0.0.2
|
diff --git a/Library/Formula/neon.rb b/Library/Formula/neon.rb
index abc1234..def5678 100644
--- a/Library/Formula/neon.rb
+++ b/Library/Formula/neon.rb
@@ -1,12 +1,15 @@ require 'brewkit'
class Neon <Formula
- @url='http://www.webdav.org/neon/neon-0.28.5.tar.gz'
+ @url='http://www.webdav.org/neon/neon-0.29.0.tar.gz'
@homepage='http://www.webdav.org/neon/'
- @md5='8c160bc0e358a3b58645acbba40fe873'
+ @md5='18a3764b70f9317f8b61509fd90d9e7a'
def install
- system "./configure --prefix='#{prefix}' --disable-debug --disable-dependency-tracking"
+ system "./configure", "--prefix=#{prefix}",
+ "--disable-debug",
+ "--disable-dependency-tracking",
+ "--with-ssl"
system "make install"
end
end
|
Bump Neon version and add --with-ssl
|
diff --git a/app/controllers/events_controller.rb b/app/controllers/events_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/events_controller.rb
+++ b/app/controllers/events_controller.rb
@@ -1,7 +1,12 @@ class EventsController < ApplicationController
def index
- @events = Event.includes(:eventable).order("event_date DESC")#.map{|event| event.eventable}
+ @date = (if params[:date]
+ Date.civil(params[:date][:year].to_i,params[:date][:month].to_i,params[:date][:day].to_i)
+ else
+ Date.today
+ end) + 1
+ @events = Event.where("event_date < ?", @date).includes(:eventable).order("event_date DESC")
end
end
|
Make date select for event list work
|
diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/groups_controller.rb
+++ b/app/controllers/groups_controller.rb
@@ -2,10 +2,15 @@ def show
if params[:id]
@group = Group.find(params[:id])
- else current_group
+ elsif current_group
@group = current_group
end
- @recent_threads = @group.threads.order("created_at DESC").limit(10)
- @recent_issues = @group.recent_issues.limit(10)
+
+ if @group
+ @recent_threads = @group.threads.order("created_at DESC").limit(10)
+ @recent_issues = @group.recent_issues.limit(10)
+ else
+ redirect_to root_url(subdomain: 'www')
+ end
end
end
|
Handle unrecognised subdomains with a redirect to www
|
diff --git a/app/steps/medicaid/amounts_income.rb b/app/steps/medicaid/amounts_income.rb
index abc1234..def5678 100644
--- a/app/steps/medicaid/amounts_income.rb
+++ b/app/steps/medicaid/amounts_income.rb
@@ -9,7 +9,7 @@
delegate(
:employed_number_of_jobs,
- :other_income_types,
+ :receives_unemployment_income?,
:self_employed?,
to: :member,
)
@@ -39,7 +39,7 @@ end
def unemployment_income_is_not_provided?
- other_income_types.include?("unemployment") && unemployment_income.blank?
+ receives_unemployment_income? && unemployment_income.blank?
end
def self_employment_income_not_provided?
|
Use existing predicate method on Member object
`receives_unemployment_income?` is defined in the member object,
therefore we can use that to ask the question istead of inspecting the
contents of the other_income_types column
|
diff --git a/app/models/idea.rb b/app/models/idea.rb
index abc1234..def5678 100644
--- a/app/models/idea.rb
+++ b/app/models/idea.rb
@@ -25,6 +25,7 @@ vote.lock!
self.lock!
self.rating += vote.value
+ self.save!
vote
end
@@ -32,6 +33,7 @@ vote.lock!
self.lock!
self.rating -= vote.value
+ self.save!
vote
end
end
|
Add 'save!' methods to Idea rating counters
Save the changes to the Idea's rating after it has been incremented or
decremented.
|
diff --git a/app/models/task.rb b/app/models/task.rb
index abc1234..def5678 100644
--- a/app/models/task.rb
+++ b/app/models/task.rb
@@ -30,9 +30,11 @@ delegate :name, :to => :assigned_user, :prefix => true,
:allow_nil => true
- scope :completed, lambda { |milestone_id|
- where(:state => Task::COMPLETED, :milestone_id => milestone_id)
- }
+ class << self
+ def completed(milestone_id)
+ where(:state => Task::COMPLETED, :milestone_id => milestone_id)
+ end
+ end
def milestone_name
milestone ? milestone.name : 'None'
|
Move the scope to a class method, since it is too long.
|
diff --git a/app/models/user.rb b/app/models/user.rb
index abc1234..def5678 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -25,14 +25,13 @@ end
def self.find_or_create_for_github_oauth(auth)
- auth.info.image.gsub!("?","")
where(github_uid: auth.uid).first_or_create do |user|
user.github_access_token = auth.credentials.token
user.github_uid = auth.uid
user.github_username = auth.info.nickname
user.name = auth.info.name
user.email = auth.info.email
- user.remote_photo_url = auth.info.image.gsub("?","")
+ user.remote_photo_url = auth.info.image
end
end
|
Revert "Remove trailing ? from Github avatar URL in the hopes that this fixes the seg"
This reverts commit 6905de3def0696220adeccc108e98ebd357fdf03.
|
diff --git a/app/models/drop.rb b/app/models/drop.rb
index abc1234..def5678 100644
--- a/app/models/drop.rb
+++ b/app/models/drop.rb
@@ -8,6 +8,12 @@ :storage => :s3,
:s3_credentials => Proc.new{|a| a.instance.s3_credentials }
validates_attachment_content_type :photo, content_type: /\Aimage\/.*\Z/
+
+ @@factory = RGeo::Geographic.spherical_factory(srid: 4326)
+
+ def self.create_lonlat(coords)
+ @@factory.point(coords[:longitude], coords[:latitude])
+ end
def has_some_content
unless photo || text
|
Add method for converting coords to rgeo points
|
diff --git a/app/models/user.rb b/app/models/user.rb
index abc1234..def5678 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -7,6 +7,11 @@ has_many :identities, dependent: :destroy
has_many :memberships, dependent: :destroy
has_many :units, through: :memberships
+
+ # TODO: This needs a real implementation
+ def groups
+ []
+ end
if Blacklight::Utils.needs_attr_accessible?
attr_accessible :email, :password, :password_confirmation
|
Add stub groups method to User
|
diff --git a/app/models/user.rb b/app/models/user.rb
index abc1234..def5678 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -27,11 +27,11 @@ end
def hours_spent
- self.projects.map {|p| p.hours}.sum
+ self.projects.map {|p| p.hours }.compact.sum
end
def words_written
- self.projects.map {|p| p.words}.sum
+ self.projects.map {|p| p.words}.compact.sum
end
end
|
Fix bug with nil values
|
diff --git a/app/models/user.rb b/app/models/user.rb
index abc1234..def5678 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -1,5 +1,7 @@ class User < ActiveRecord::Base
# Remember to create a migration!
+ has_secure_password
+
has_many :messages
has_many :sent_messages, foreign_key: "sender_id", class_name: "Message"
|
Add has_secure_password to User model
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.