diff stringlengths 65 26.7k | message stringlengths 7 9.92k |
|---|---|
diff --git a/app/models/network.rb b/app/models/network.rb
index abc1234..def5678 100644
--- a/app/models/network.rb
+++ b/app/models/network.rb
@@ -25,7 +25,7 @@ """.squish
ActiveRecord::Base.send(:sanitize_sql_array, [
- dirty_query, protected_areas.map(&:wdpa_id)
+ dirty_query, protected_areas.pluck(:wdpa_id)
])
end
| Use pluck to save memory
|
diff --git a/mogli.gemspec b/mogli.gemspec
index abc1234..def5678 100644
--- a/mogli.gemspec
+++ b/mogli.gemspec
@@ -9,8 +9,10 @@ s.author = 'Mike Mangino'
s.email = 'mmangino@elevatedrails.com'
s.homepage = 'http://developers.facebook.com/docs/api'
+ s.add_dependency 'hashie', '~> 1.1.0'
s.add_dependency 'httparty', '>= 0.4.3'
- s.add_dependency 'hashie', '~> 1.1.0'
+ s.add_dependency 'multi_json', '~> 1.0.3'
+ s.add_development_dependency 'json'
s.add_development_dependency 'rake'
s.add_development_dependency 'rspec'
end
| Add json dependency for compatibility with Ruby versions < 1.9
|
diff --git a/spec/controllers/lti_launches_controller_spec.rb b/spec/controllers/lti_launches_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/lti_launches_controller_spec.rb
+++ b/spec/controllers/lti_launches_controller_spec.rb
@@ -4,9 +4,7 @@
before do
@app = FactoryGirl.create(:lti_application_instance)
-
allow(controller).to receive(:current_lti_application_instance).and_return(@app)
- allow(LtiApplication).to receive(:find_by).with(:lti_key).and_return(@app)
end
describe "index" do
| Remove unused line from spec.
|
diff --git a/spec/models/generic_announcement_ability_spec.rb b/spec/models/generic_announcement_ability_spec.rb
index abc1234..def5678 100644
--- a/spec/models/generic_announcement_ability_spec.rb
+++ b/spec/models/generic_announcement_ability_spec.rb
@@ -0,0 +1,63 @@+require 'rails_helper'
+
+RSpec.describe GenericAnnouncement do
+ let!(:instance) { create(:instance) }
+ with_tenant(:instance) do
+ subject { Ability.new(user) }
+ let!(:not_started_system_announcement) do
+ GenericAnnouncement.find(create(:system_announcement, :not_started).id)
+ end
+ let!(:ended_system_announcement) do
+ GenericAnnouncement.find(create(:system_announcement, :ended).id)
+ end
+ let!(:valid_system_announcement) do
+ GenericAnnouncement.find(create(:system_announcement).id)
+ end
+
+ let!(:not_started_instance_announcement) do
+ GenericAnnouncement.find(create(:instance_announcement, :not_started).id)
+ end
+ let!(:ended_instance_announcement) do
+ GenericAnnouncement.find(create(:instance_announcement, :ended).id)
+ end
+ let!(:valid_instance_announcement) do
+ GenericAnnouncement.find(create(:instance_announcement).id)
+ end
+
+ context 'when the user is an Instance User' do
+ let(:user) { create(:instance_user).user }
+
+ it { is_expected.to be_able_to(:show, valid_system_announcement) }
+ it { is_expected.to be_able_to(:show, ended_system_announcement) }
+ it { is_expected.not_to be_able_to(:show, not_started_system_announcement) }
+
+ it { is_expected.to be_able_to(:show, valid_instance_announcement) }
+ it { is_expected.to be_able_to(:show, ended_instance_announcement) }
+ it { is_expected.not_to be_able_to(:show, not_started_instance_announcement) }
+ end
+
+ context 'when the user is an Instance Administrator' do
+ let(:user) { create(:instance_administrator).user }
+
+ it { is_expected.not_to be_able_to(:manage, valid_system_announcement) }
+ it { is_expected.not_to be_able_to(:manage, ended_system_announcement) }
+ it { is_expected.not_to be_able_to(:manage, not_started_system_announcement) }
+
+ it { is_expected.to be_able_to(:manage, valid_instance_announcement) }
+ it { is_expected.to be_able_to(:manage, not_started_instance_announcement) }
+ it { is_expected.to be_able_to(:manage, ended_instance_announcement) }
+ end
+
+ context 'when the user is an Administrator' do
+ let(:user) { create(:administrator) }
+
+ it { is_expected.to be_able_to(:manage, valid_system_announcement) }
+ it { is_expected.to be_able_to(:manage, ended_system_announcement) }
+ it { is_expected.to be_able_to(:manage, not_started_system_announcement) }
+
+ it { is_expected.to be_able_to(:manage, valid_instance_announcement) }
+ it { is_expected.to be_able_to(:manage, not_started_instance_announcement) }
+ it { is_expected.to be_able_to(:manage, ended_instance_announcement) }
+ end
+ end
+end
| Add generic annoucements model specs
|
diff --git a/core/thread/list_spec.rb b/core/thread/list_spec.rb
index abc1234..def5678 100644
--- a/core/thread/list_spec.rb
+++ b/core/thread/list_spec.rb
@@ -35,8 +35,21 @@ t.join
end
end
+
+ it "returns instances of Thread and not null or nil values" do
+ spawner = Thread.new do
+ Array.new(100) do
+ Thread.new {}
+ end
+ end
+
+ while spawner.alive?
+ Thread.list.each { |th|
+ th.should be_kind_of(Thread)
+ }
+ end
+
+ threads = spawner.value
+ threads.each(&:join)
+ end
end
-
-describe "Thread.list" do
- it "needs to be reviewed for spec completeness"
-end
| Add spec for Thread.list under concurrent load
|
diff --git a/tabs_for.gemspec b/tabs_for.gemspec
index abc1234..def5678 100644
--- a/tabs_for.gemspec
+++ b/tabs_for.gemspec
@@ -18,6 +18,8 @@ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib", "app"]
+ spec.required_ruby_version = '>= 1.9.3'
+
spec.add_dependency "rails", "~> 4.0"
spec.add_development_dependency "bundler", "~> 1.10"
| Set minimum required ruby version to 1.9.3
|
diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb
index abc1234..def5678 100644
--- a/config/initializers/filter_parameter_logging.rb
+++ b/config/initializers/filter_parameter_logging.rb
@@ -8,4 +8,4 @@
-Rails.application.config.filter_parameters += [:password, :email, :name, :age, :employment_status, :primary_phone, :secondary_phone, :city, :state, :zip, :appointment_date, :insurance, :street_address_1, :street_address_2, :urgent_flag, :income, :special_circumstances, :procedure_cost, :procedure_date, :procedure_completed_date, :household_size, :full_text]
+Rails.application.config.filter_parameters += [:password, :email, :name, :age, :employment_status, :primary_phone, :secondary_phone, :city, :state, :zip, :appointment_date, :insurance, :street_address_1, :street_address_2, :urgent_flag, :income, :special_circumstances, :procedure_cost, :procedure_date, :procedure_completed_date, :household_size, :full_text, :search]
| Add :search to filtered parameters
|
diff --git a/lib/acts_as_notifiable/notifiable/callback.rb b/lib/acts_as_notifiable/notifiable/callback.rb
index abc1234..def5678 100644
--- a/lib/acts_as_notifiable/notifiable/callback.rb
+++ b/lib/acts_as_notifiable/notifiable/callback.rb
@@ -6,7 +6,7 @@
# Create a notification if there is a receiver to receive it
def notification_callback
- notify if notice_receiver
+ notify if notify?
end
# Notify the receiver(s) of what happend
@@ -23,6 +23,11 @@ self.notifications.create :receiver => to_notify,
:sender => notice_sender,
:target => notice_target
+ end
+
+ # Determine whether or not the notification should be sent
+ def notify?
+ !notice_receiver.nil?
end
# Interpret a target which can be either a proc or a method
| Refactor to make notify? more modular
|
diff --git a/week-6/gps.rb b/week-6/gps.rb
index abc1234..def5678 100644
--- a/week-6/gps.rb
+++ b/week-6/gps.rb
@@ -0,0 +1,43 @@+# Your Names
+# 1)
+# 2)
+
+# We spent [#] hours on this challenge.
+
+# Bakery Serving Size portion calculator.
+
+def serving_size_calc(item_to_make, order_quantity)
+ library = {"cookie" => 1, "cake" => 5, "pie" => 7}
+ error_counter = 3
+
+ library.each do |food|
+ if library[food] != library[item_to_make]
+ p error_counter += -1
+ end
+ end
+
+ if error_counter > 0
+ raise ArgumentError.new("#{item_to_make} is not a valid input")
+ end
+
+ serving_size = library.values_at(item_to_make)[0]
+ serving_size_mod = order_quantity % serving_size
+
+ case serving_size_mod
+ when 0
+ return "Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}"
+ else
+ return "Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}, you have #{serving_size_mod} leftover ingredients. Suggested baking items: TODO: MAKE THIS FEATURE"
+ end
+end
+
+p serving_size_calc("pie", 7)
+p serving_size_calc("pie", 8)
+p serving_size_calc("cake", 5)
+p serving_size_calc("cake", 7)
+p serving_size_calc("cookie", 1)
+p serving_size_calc("cookie", 10)
+p serving_size_calc("THIS IS AN ERROR", 5)
+
+# Reflection
+
| Add initial GPS file week 6
|
diff --git a/lib/packaging/gem/lib/govuk_frontend_alpha.rb b/lib/packaging/gem/lib/govuk_frontend_alpha.rb
index abc1234..def5678 100644
--- a/lib/packaging/gem/lib/govuk_frontend_alpha.rb
+++ b/lib/packaging/gem/lib/govuk_frontend_alpha.rb
@@ -27,8 +27,23 @@ end
module ApplicationHelper
- def govuk_component(name, props)
- render partial: "components/#{name}", locals: props.with_indifferent_access
+ def govuk_component
+ # allows components to be called like this:
+ # `govuk_component.button(text: 'Start now')`
+ DynamicComponentRenderer.new(self)
+ end
+
+ class DynamicComponentRenderer
+ def initialize(view_context)
+ @view_context = view_context
+ end
+
+ def method_missing(method, *args, &block)
+ @view_context.render(
+ partial: "components/#{method.to_s}",
+ locals: args.first.with_indifferent_access
+ )
+ end
end
end
end
| Improve the rails helper invocation syntax
Make it closer to how nunjucks works for better consistency, and
not having to treate component names as string, instead they act
more like functions, which is the model we're trying to follow
|
diff --git a/core/app/controllers/opinionators_controller.rb b/core/app/controllers/opinionators_controller.rb
index abc1234..def5678 100644
--- a/core/app/controllers/opinionators_controller.rb
+++ b/core/app/controllers/opinionators_controller.rb
@@ -20,7 +20,6 @@
type = params[:type]
@fact.add_opinion(type, current_user.graph_user)
- Activity.create user: current_user.graph_user, action: type, subject: @fact
render json: {}
end
| Remove creating activities for opinions
|
diff --git a/mina-unicorn.gemspec b/mina-unicorn.gemspec
index abc1234..def5678 100644
--- a/mina-unicorn.gemspec
+++ b/mina-unicorn.gemspec
@@ -20,4 +20,5 @@
spec.add_development_dependency "bundler", "~> 1.5"
spec.add_development_dependency "rake"
+ spec.add_development_dependency "mina", "~> 0.3"
end
| Add mina as a development dependency
|
diff --git a/spec/sorted/orms/active_record_spec.rb b/spec/sorted/orms/active_record_spec.rb
index abc1234..def5678 100644
--- a/spec/sorted/orms/active_record_spec.rb
+++ b/spec/sorted/orms/active_record_spec.rb
@@ -4,7 +4,7 @@ ActiveRecord::Base.send(:include, Sorted::Orms::ActiveRecord)
class SortedActiveRecordTest < ActiveRecord::Base
- establish_connection :adapter => 'sqlite3', :database => '/tmp/foobar.db'
+ establish_connection :adapter => 'sqlite3', :database => ':memory:'
connection.create_table table_name, :force => true do |t|
t.string :name
| Use in memory for db tests.
|
diff --git a/features/step_definitions/validation_steps.rb b/features/step_definitions/validation_steps.rb
index abc1234..def5678 100644
--- a/features/step_definitions/validation_steps.rb
+++ b/features/step_definitions/validation_steps.rb
@@ -1,5 +1,5 @@ def strip_onpaste_element_used_to_disable_pasting_emails(body)
- body.gsub!(/(onpaste=\".*\")/, '')
+ body.gsub!(/(onpaste=\".*?\")/, '')
end
Then /^the markup should be valid$/ do
| Fix tidying up onpaste attributes before html validation
We simply make strip_onpaste_element_used_to_disable_pasting_emails use a non-greedy regexp. With the original greedy regexp it would turn ``<input onpaste="return false;" id="cheese"/>`` into ``<input />``, with the non-greedy regexp it turns it into ``<input id="cheese"/>``.
|
diff --git a/exchange.rb b/exchange.rb
index abc1234..def5678 100644
--- a/exchange.rb
+++ b/exchange.rb
@@ -0,0 +1,50 @@+class Exchange
+ class InvalidCurrency < StandardError
+ end
+
+ def convert(money, currency)
+ currencies = %w(eur pln gbp usd chf jpy)
+
+ rates = {
+ eur_eur: 1,
+ pln_pln: 1,
+ gbp_gbp: 1,
+ usd_usd: 1,
+ chf_chf: 1,
+ jpy_jpy: 1,
+ eur_pln: 4.1860200000000001,
+ eur_gbp: 0.78663899999999998,
+ eur_usd: 1.2842100000000001,
+ eur_chf: 1.2069399999999999,
+ eur_jpy: 139.82900000000001,
+ pln_gbp: 0.188109,
+ pln_usd: 0.30696899999999999,
+ pln_chf: 0.28841600000000001,
+ pln_jpy: 33.414700000000003,
+ gbp_usd: 1.6322099999999999,
+ gbp_chf: 1.5336399999999999,
+ gbp_jpy: 177.63399999999999,
+ usd_chf: 0.93984500000000004,
+ usd_jpy: 108.866,
+ chf_jpy: 115.85899999999999
+ }
+
+ conversion = "#{money.currency.downcase}_#{currency.downcase}".to_sym
+ conversion_inverted = "#{currency.downcase}_#{money.currency.downcase}".to_sym
+
+ if rates[conversion]
+ rate = rates[conversion]
+ elsif rates[conversion_inverted]
+ rate = 1 / rates[conversion_inverted]
+ else
+ invalid_currencies = []
+ invalid_currencies << money.currency unless currencies.include?(money.currency.downcase)
+ invalid_currencies << currency unless currencies.include?(currency.downcase)
+ invalid_currencies = invalid_currencies.uniq
+
+ raise InvalidCurrency, "Invalid currencies: #{invalid_currencies.join(', ')}"
+ end
+
+ rate * money.value
+ end
+end
| Add Exchange class and implement it's convert method
|
diff --git a/lib/twentyfour_seven_office/data_types/company.rb b/lib/twentyfour_seven_office/data_types/company.rb
index abc1234..def5678 100644
--- a/lib/twentyfour_seven_office/data_types/company.rb
+++ b/lib/twentyfour_seven_office/data_types/company.rb
@@ -7,6 +7,8 @@ attribute :id, Integer
attribute :name, String
attribute :organization_number, String
+ attribute :country, String
+ attribute :type, String
attribute :addresses, Addresses
attribute :phone_numbers, PhoneNumbers
attribute :email_addresses, EmailAddresses
| Add country and type attributes to Company |
diff --git a/lib/indocker/networks/network_metadata_repository.rb b/lib/indocker/networks/network_metadata_repository.rb
index abc1234..def5678 100644
--- a/lib/indocker/networks/network_metadata_repository.rb
+++ b/lib/indocker/networks/network_metadata_repository.rb
@@ -12,7 +12,7 @@ end
def find_by_name(name)
- network_metadata = @all.detect {|network| network.name == name.to_s}
+ network_metadata = all.detect {|network| network.name == name.to_s}
raise Indocker::Errors::NetworkIsNotDefined unless network_metadata
network_metadata
| Fix error in networks metadata repository
|
diff --git a/app/models/role.rb b/app/models/role.rb
index abc1234..def5678 100644
--- a/app/models/role.rb
+++ b/app/models/role.rb
@@ -16,7 +16,8 @@
def list_features
list = feature_permissions.map do |fp|
- name = fp.feature.name
+ name = I18n.t("admin.features.#{fp.feature.name}")
+ name = fp.feature.name if name.include? 'translation missing'
name += ' (Read-Only)' if fp.read_only
name
end
| Use use translations when listing features (if available).
|
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
@@ -22,7 +22,7 @@ end
def is_device_registered?
- not self.firebase_registration_token.empty?
+ not self.firebase_registration_token.nil?
end
end
| Fix empty? invokation instead of nil?
|
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 @@
# API
devise :token_authenticatable
- before_save :reset_authentication_token
+ before_save :ensure_authentication_token
# Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation, :remember_me
| Use ensure_authentication_token, not reset_... as devise hook in User.
|
diff --git a/spec/models/team_spec.rb b/spec/models/team_spec.rb
index abc1234..def5678 100644
--- a/spec/models/team_spec.rb
+++ b/spec/models/team_spec.rb
@@ -1,4 +1,4 @@-require 'spec_helper'
+require "active_record_spec_helper"
describe Team do
describe "validations" do
| Add AR spec helper to team spec
|
diff --git a/spec/support/matchers.rb b/spec/support/matchers.rb
index abc1234..def5678 100644
--- a/spec/support/matchers.rb
+++ b/spec/support/matchers.rb
@@ -4,6 +4,10 @@ match do |chef_run|
regexp = Regexp.new("^#{Regexp.quote(@attribute)}=#{@value}$")
render_file(configuration_file).with_content(regexp).matches?(chef_run)
+ end
+
+ failure_message_for_should do |actual|
+ "expected that #{configuration_file} would be configured with #{@attribute} as #{@value}"
end
chain :as do |value|
| Add nicer failure message for have_configured matcher |
diff --git a/rfunk.gemspec b/rfunk.gemspec
index abc1234..def5678 100644
--- a/rfunk.gemspec
+++ b/rfunk.gemspec
@@ -20,5 +20,6 @@ s.add_dependency 'atomic', '~> 1.1.16'
s.add_development_dependency 'rake', '~> 10.3.2'
+ s.add_development_dependency 'rspec', '~> 2.14.1'
s.add_development_dependency 'rspec-given', '~> 3.5.4'
end
| Make sure we specify the version of rspec.
|
diff --git a/app/models/concerns/rankable.rb b/app/models/concerns/rankable.rb
index abc1234..def5678 100644
--- a/app/models/concerns/rankable.rb
+++ b/app/models/concerns/rankable.rb
@@ -8,7 +8,8 @@ end
def rank
- Redis.current.zcount(ranking_key, "(#{stargazers_count}", '+inf') + 1
+ super
+ # Redis.current.zcount(ranking_key, "(#{stargazers_count}", '+inf') + 1
rescue Redis::CannotConnectError
super
end
| Revert "Use redis rank again"
This reverts commit 4cb5891292dc9bcca1b8498bfd479b49b044e036.
|
diff --git a/app/models/etsource/reloader.rb b/app/models/etsource/reloader.rb
index abc1234..def5678 100644
--- a/app/models/etsource/reloader.rb
+++ b/app/models/etsource/reloader.rb
@@ -10,14 +10,21 @@ # Etsource::Reloader.start!
#
class Reloader
+ DIRS = %w( carriers datasets edges gqueries inputs nodes presets )
+
class << self
def start!
return true if @listener
- @listener = Listen.to(ETSOURCE_EXPORT_DIR.to_s)
- @listener.filter(%r{(?:data|datasets|presets)/.*})
- @listener.change { |*| reload! }
- @listener.start(false)
+ watched_dirs = DIRS.map(&Regexp.method(:escape)).join('|')
+
+ Rails.logger.info('-' * 100)
+ Rails.logger.info(watched_dirs)
+ Rails.logger.info('-' * 100)
+
+ @listener = Listen.to(ETSOURCE_EXPORT_DIR.to_s) { |*| reload! }
+ @listener.only(%r{(?:#{ watched_dirs })/.*})
+ @listener.start
Rails.logger.info 'ETsource live reload: Listener started.'
| Update Reloader to work with Listen v2
|
diff --git a/app/models/mailboxer/message.rb b/app/models/mailboxer/message.rb
index abc1234..def5678 100644
--- a/app/models/mailboxer/message.rb
+++ b/app/models/mailboxer/message.rb
@@ -34,8 +34,8 @@ temp_receipts = [sender_receipt] + receiver_receipts
if temp_receipts.all?(&:valid?)
+ temp_receipts.each(&:save!)
Mailboxer::MailDispatcher.new(self, receiver_receipts).call
- temp_receipts.each(&:save!)
conversation.touch if reply
| Call save before delivering email
|
diff --git a/test/cookbooks/python-webapp-test/recipes/_centos.rb b/test/cookbooks/python-webapp-test/recipes/_centos.rb
index abc1234..def5678 100644
--- a/test/cookbooks/python-webapp-test/recipes/_centos.rb
+++ b/test/cookbooks/python-webapp-test/recipes/_centos.rb
@@ -0,0 +1,26 @@+#
+# Cookbook Name:: osl_application_python_test
+# Recipe:: _centos
+#
+# Copyright 2015, Oregon State University
+#
+# Licensed under the Apache License, Version 2.0 (the 'License');
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an 'AS IS' BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+if node['platform_version'] == '6.6'
+ include_recipe 'yum-ius'
+ include_recipe 'yum-epel'
+
+ %w(gcc python27 python27-devel python27-pip).each do |pkg|
+ package pkg
+ end
+end
| Add a Centos 6 specific recipe
|
diff --git a/spec/unit/spec_helper.rb b/spec/unit/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/unit/spec_helper.rb
+++ b/spec/unit/spec_helper.rb
@@ -4,9 +4,7 @@
RSpec.configure do |config|
config.platform = 'mac_os_x'
- config.version = '10.8.2' # FIXME: system ruby and fauxhai don't play nice
- # since there is no 10.9.2.json file yet. We
- # should submit a PR to fauxhai to fix this
+ config.version = '10.11.1'
config.before { stub_const('ENV', 'SUDO_USER' => 'fauxhai') }
config.after(:suite) { FileUtils.rm_r('.librarian') }
end
| Update fauxhai's OS X platform
|
diff --git a/spec/integration/messages_spec.rb b/spec/integration/messages_spec.rb
index abc1234..def5678 100644
--- a/spec/integration/messages_spec.rb
+++ b/spec/integration/messages_spec.rb
@@ -6,6 +6,7 @@ let(:client) { AngellistApi::Client.new }
it 'gets all messages for a user' do
+ pending 'an approach for VCR integration testing without exposing a key publicly'
messages = client.get_messages
messages.first.should have_key :thread_id
end
| Make a spec pending until we figure something out for auth
|
diff --git a/spec/models/phenotype_snp_spec.rb b/spec/models/phenotype_snp_spec.rb
index abc1234..def5678 100644
--- a/spec/models/phenotype_snp_spec.rb
+++ b/spec/models/phenotype_snp_spec.rb
@@ -1,13 +1,36 @@ RSpec.describe PhenotypeSnp do
+ let(:snp) { FactoryGirl.create(:snp) }
+ let(:phenotype) { FactoryGirl.create(:phenotype) }
+
subject do
+ PhenotypeSnp.create :snp_id => snp.id, :phenotype_id => phenotype.id
end
- describe 'snp' do
- it 'has at least one phenotype' do
- end
+ it 'has a unique (snp, phenotype) id pair' do
+ subject.save!
+ rel_a = PhenotypeSnp.new :snp_id => snp.id,
+ :phenotype_id => phenotype.id
- it 'has a non-negative score' do
- end
+ expect {rel_a.save!}.to raise_error(ActiveRecord::RecordNotUnique)
+ end
+
+ it 'has a non-negative, not null score' do
+ expect(subject.score).not_to be_nil
+ expect(subject.score).to be >= 0
+ end
+
+ it 'validates the presence of snp id' do
+ rel_a = PhenotypeSnp.create :snp_id => snp.id, :phenotype_id => 999
+
+ expect(rel_a).not_to be_valid
+ expect(rel_a.errors.messages[:phenotype]).to include("can't be blank")
+ end
+
+ it 'validates the presence of phenotype id' do
+ rel_a = PhenotypeSnp.create :snp_id => 999, :phenotype_id => phenotype.id
+
+ expect(rel_a).not_to be_valid
+ expect(rel_a.errors.messages[:snp]).to include("can't be blank")
end
end
| Expand the spec for PhenotypeSnp model
Signed-off-by: Vivek Rai <4b8b65dd320e6035df8e26fe45ee3876d9e0f96b@gmail.com>
|
diff --git a/spec/rrj/models/janus_instance.rb b/spec/rrj/models/janus_instance.rb
index abc1234..def5678 100644
--- a/spec/rrj/models/janus_instance.rb
+++ b/spec/rrj/models/janus_instance.rb
@@ -7,7 +7,7 @@ let(:model) { RubyRabbitmqJanus::Models::JanusInstance }
context 'active record model' do
- it { expect(model.attribute_names).to include('_id') }
+ it { expect(model.attribute_names).to include(ENV['MONGO'].match?('true') ? '_id' : 'id') }
it { expect(model.attribute_names).to include('instance') }
it { expect(model.attribute_names).to include('session') }
it { expect(model.attribute_names).to include('enable') }
| Fix ID name if mongo or active record
|
diff --git a/Casks/x-lite.rb b/Casks/x-lite.rb
index abc1234..def5678 100644
--- a/Casks/x-lite.rb
+++ b/Casks/x-lite.rb
@@ -5,8 +5,8 @@ # amazonaws.com is the official download host per the vendor homepage
url 'http://counterpath.s3.amazonaws.com/downloads/X-Lite_4.8.4_t-xlite484-20150526-4800f_76590.dmg'
name 'X-Lite'
- homepage 'http://www.counterpath.com/x-lite.html'
- license :unknown # todo: change license and remove this comment; ':unknown' is a machine-generated placeholder
+ homepage 'http://www.counterpath.com/x-lite/'
+ license :commercial
app 'X-Lite.app'
end
| Update X-Lite.app's homepage and license.
|
diff --git a/app/models/page_template.rb b/app/models/page_template.rb
index abc1234..def5678 100644
--- a/app/models/page_template.rb
+++ b/app/models/page_template.rb
@@ -8,8 +8,11 @@ # Returns all widgets, not just those belonging to this template
# but also those belonging to this page's layout
def all_widgets
- found_widgets = self.widgets
- found_widgets += self.current_layout.widgets if self.current_layout
+ if self.current_layout
+ return self.widgets + self.current_layout.widgets
+ else
+ return self.widgets
+ end
end
end | Change in page template widget data id loading making it more reliable.
|
diff --git a/fastly.gemspec b/fastly.gemspec
index abc1234..def5678 100644
--- a/fastly.gemspec
+++ b/fastly.gemspec
@@ -5,16 +5,19 @@ Gem::Specification.new do |s|
s.name = "fastly"
s.version = Fastly::VERSION
- s.authors = ["Simon Wistow"]
- s.email = ["simon@fastly.com"]
- s.homepage = ""
- s.summary = %q{TODO: Write a gem summary}
- s.description = %q{TODO: Write a gem description}
-
- s.rubyforge_project = "fastly"
+ s.authors = ["Fastly Inc"]
+ s.email = ["support@fastly.com"]
+ s.homepage = "http://github.com/fastly/fastly-ruby"
+ s.summary = %q{Client library for the Fastly acceleration system}
+ s.description = %q{Client library for the Fastly acceleration system}
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]
+
+ s.add_dependency 'json'
+ s.add_dependency 'curb', '>=0.7.15'
+ s.add_dependency 'curb-fu', '>=0.6.1'
+ s.add_dependency 'rdoc', '>=3.11'
end
| Make sure the gemspec is up to date
|
diff --git a/Casks/screaming-frog-seo-spider.rb b/Casks/screaming-frog-seo-spider.rb
index abc1234..def5678 100644
--- a/Casks/screaming-frog-seo-spider.rb
+++ b/Casks/screaming-frog-seo-spider.rb
@@ -3,8 +3,8 @@ version '2.40'
sha256 'f37a517cb1ddb13a0621ae2ef98eba148027b3a2b5ce56b6e6b4ca756e40329b'
else
- version '4.1'
- sha256 '6594f7792f04651f37dd55c2e7926649c4f27efc43e158b86f0f308ac81ee063'
+ version '5.1'
+ sha256 'bd4ccf73c8ee99e4da893a832bf85155820659cc5a61f72df33d39871fcc7b66'
end
url "https://www.screamingfrog.co.uk/products/seo-spider/ScreamingFrogSEOSpider-#{version}.dmg"
| Update ScreamingFfrog SEO Spider to 5.1
|
diff --git a/spec/unit/concurrent/linked_continuation_queue_spec.rb b/spec/unit/concurrent/linked_continuation_queue_spec.rb
index abc1234..def5678 100644
--- a/spec/unit/concurrent/linked_continuation_queue_spec.rb
+++ b/spec/unit/concurrent/linked_continuation_queue_spec.rb
@@ -1,8 +1,8 @@ require "spec_helper"
-require "bunny/concurrent/linked_continuation_queue"
+if defined?(JRUBY_VERSION)
+ require "bunny/concurrent/linked_continuation_queue"
-if defined?(JRUBY_VERSION)
describe Bunny::Concurrent::LinkedContinuationQueue do
describe "#poll with a timeout that is never reached" do
it "blocks until the value is available, then returns it" do
| Move this require under the platform guard
|
diff --git a/test/integration/feature_test.rb b/test/integration/feature_test.rb
index abc1234..def5678 100644
--- a/test/integration/feature_test.rb
+++ b/test/integration/feature_test.rb
@@ -18,6 +18,12 @@ page.must_have_content 'success'
end
+ it 'only works once' do
+ current_email.first(:link).click
+ current_email.first(:link).click
+ page.must_have_content 'failed'
+ end
+
# it 'logs in a user with an optional passcode'
end
| Make sure login links only work once
|
diff --git a/config/application.rb b/config/application.rb
index abc1234..def5678 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -12,6 +12,7 @@ config.load_defaults "6.0"
# Default locale Japanese
config.i18n.default_locale = :ja
+ Rails.application.config.action_controller.urlsafe_csrf_tokens = false
# Settings in config/environments/* take precedence over those specified here.
# Application configuration can go into files in config/initializers
| Upgrade Rails 5.2.6 -> 6.0.0
- Modify settings
|
diff --git a/config/application.rb b/config/application.rb
index abc1234..def5678 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -4,7 +4,6 @@ # Pick the frameworks you want:
require "active_job/railtie"
require "active_record/railtie"
-require "active_storage/engine"
require "action_controller/railtie"
require "action_view/railtie"
require "action_mailer/railtie"
| Remove Active storage from app
|
diff --git a/test/fixtures/cookbooks/test/recipes/instance.rb b/test/fixtures/cookbooks/test/recipes/instance.rb
index abc1234..def5678 100644
--- a/test/fixtures/cookbooks/test/recipes/instance.rb
+++ b/test/fixtures/cookbooks/test/recipes/instance.rb
@@ -20,7 +20,17 @@ action [:start, :enable]
end
-if platform?('centos') && node['platform_version'].to_f < 7.0
+if Chef::Platform::ServiceHelpers.service_resource_providers.include?(:systemd)
+ memcached_instance_systemd 'painful_cache' do
+ port 11_214
+ udp_port 11_214
+ memory 64
+ ulimit 31_337
+ threads 10
+ user 'memcached_painful_cache'
+ action [:start, :enable]
+ end
+else
memcached_instance_sysv_init 'painful_cache' do
port 11_214
udp_port 11_214
@@ -30,14 +40,4 @@ user 'memcached_painful_cache'
action [:start, :enable]
end
-else
- memcached_instance_systemd 'painful_cache' do
- port 11_214
- udp_port 11_214
- memory 64
- ulimit 31_337
- threads 10
- user 'memcached_painful_cache'
- action [:start, :enable]
- end
end
| Use systemd in specs when available else fallback to init
|
diff --git a/spec/unit/virtus/instance_methods/initialize_spec.rb b/spec/unit/virtus/instance_methods/initialize_spec.rb
index abc1234..def5678 100644
--- a/spec/unit/virtus/instance_methods/initialize_spec.rb
+++ b/spec/unit/virtus/instance_methods/initialize_spec.rb
@@ -25,16 +25,22 @@ end
context 'with an argument that responds to #to_hash' do
- subject { described_class.new(:name => name) }
+ subject { described_class.new(attributes) }
- let(:name) { stub('name') }
+ let(:attributes) do
+ Class.new do
+ def to_hash
+ {:name => 'John'}
+ end
+ end.new
+ end
it 'sets attributes' do
- subject.name.should be(name)
+ subject.name.should == 'John'
end
end
- context' with an argument that does not respond to #to_hash' do
+ context 'with an argument that does not respond to #to_hash' do
subject { described_class.new(Object.new) }
specify { expect { subject }.to raise_error(NoMethodError) }
| Fix a test that failed when rspec 2 was used
|
diff --git a/app/controllers/admin/journals_controller.rb b/app/controllers/admin/journals_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/admin/journals_controller.rb
+++ b/app/controllers/admin/journals_controller.rb
@@ -12,7 +12,7 @@ end
def create
- respond_with Journal.create(journal_params), serializer: AdminJournalSerializer, root: 'admin_journals'
+ respond_with Journal.create(journal_params), serializer: AdminJournalSerializer, root: 'admin_journal'
end
def update
| Correct plurality on admin journal payload.
|
diff --git a/spec/orm_helper.rb b/spec/orm_helper.rb
index abc1234..def5678 100644
--- a/spec/orm_helper.rb
+++ b/spec/orm_helper.rb
@@ -1,4 +1,6 @@-require 'sqlite3'
+adapter = RUBY_PLATFORM == 'java' ? 'jdbc-mysql' : 'mysql2'
+require adapter
+
require 'active_record'
require "kindergarten/orm/governess"
@@ -9,7 +11,8 @@
ActiveRecord::Base.logger = logger
ActiveRecord::Base.establish_connection(
- :adapter => 'sqlite3',
- :database => File.expand_path( "../support/db/test.db", __FILE__),
+ :adapter => adapter,
+ :database => 'kindergarten_test',
+ :username => 'root',
+ :encoding => 'utf8'
)
-
| Change adapter based on platform
|
diff --git a/spec/test_value.rb b/spec/test_value.rb
index abc1234..def5678 100644
--- a/spec/test_value.rb
+++ b/spec/test_value.rb
@@ -1,3 +1,4 @@+require 'spec_helper'
$VALUES.each do |value|
describe "#{value} (#{value.class})" do
subject{ value }
| Add spec_helper is definitely required there
|
diff --git a/utensils.gemspec b/utensils.gemspec
index abc1234..def5678 100644
--- a/utensils.gemspec
+++ b/utensils.gemspec
@@ -5,11 +5,11 @@ Gem::Specification.new do |s|
s.name = "utensils"
s.version = Utensils::VERSION
- s.authors = ["TODO: Your name"]
- s.email = ["TODO: Your email"]
- s.homepage = "TODO"
- s.summary = "TODO: Summary of Utensils."
- s.description = "TODO: Description of Utensils."
+ s.authors = ["Matt Kitt"]
+ s.email = ["info@modeset.com"]
+ s.homepage = "https://github.com/modeset/utensils"
+ s.summary = "A UI component library"
+ s.description = "A UI component library"
s.files = Dir["{app,config,lib,vendor}/**/*"] + ["MIT-LICENSE", "README.md"]
s.test_files = Dir["spec/**/*"]
| Add valid meta data to gemspec |
diff --git a/spec/integration/multiple_invocations_spec.rb b/spec/integration/multiple_invocations_spec.rb
index abc1234..def5678 100644
--- a/spec/integration/multiple_invocations_spec.rb
+++ b/spec/integration/multiple_invocations_spec.rb
@@ -0,0 +1,42 @@+# encoding: utf-8
+
+require 'spec_helper'
+
+describe Github, 'invocations' do
+
+ context 'repo commits with sha' do
+ let(:user) { "peter-murach" }
+ let(:repo) { "github" }
+ let(:sha) { "ceb66b61264657898cd6608c7e9ed78072169664" }
+
+ let(:request_path) { "/repos/#{user}/#{repo}/commits/#{sha}" }
+
+ before {
+ stub_get(request_path).to_return(:body => nil, :status => 200,
+ :headers => {:content_type => "application/json; charset=utf-8"})
+ }
+
+ it 'requests commit information twice' do
+ subject.repos.commits.get user, repo, sha
+ subject.repos.commits.get user, repo, sha
+ a_get(request_path).should have_been_made.times(2)
+ end
+ end
+
+ context 'organization info' do
+ let(:org) { "thoughtbot" }
+
+ let(:request_path) { "/orgs/#{org}" }
+
+ before {
+ stub_get(request_path).to_return(:body => nil, :status => 200,
+ :headers => {:content_type => "application/json; charset=utf-8"})
+ }
+
+ it 'requests organization information twice' do
+ subject.orgs.get org
+ subject.orgs.get org
+ a_get(request_path).should have_been_made.times(2)
+ end
+ end
+end
| Add integration specs for stack overflow bug.
|
diff --git a/lib/bash/session.rb b/lib/bash/session.rb
index abc1234..def5678 100644
--- a/lib/bash/session.rb
+++ b/lib/bash/session.rb
@@ -29,7 +29,7 @@ end
end
- exit_status
+ exit_status.to_i
end
private
| Change the exit status to return an integer
|
diff --git a/test/flows/maternity_paternity_calculator_flow_test.rb b/test/flows/maternity_paternity_calculator_flow_test.rb
index abc1234..def5678 100644
--- a/test/flows/maternity_paternity_calculator_flow_test.rb
+++ b/test/flows/maternity_paternity_calculator_flow_test.rb
@@ -0,0 +1,34 @@+require "test_helper"
+require "support/flow_test_helper"
+
+class MaternityPaternityCalculatorFlowTest < ActiveSupport::TestCase
+ include FlowTestHelper
+
+ setup { testing_flow MaternityPaternityCalculatorFlow }
+
+ should "render a start page" do
+ assert_rendered_start_page
+ end
+
+ context "question: what_type_of_leave?" do
+ setup { testing_node :what_type_of_leave? }
+
+ should "render the question" do
+ assert_rendered_question
+ end
+
+ context "next_node" do
+ should "have a next node of baby_due_date_maternity? for a 'maternity' response" do
+ assert_next_node :baby_due_date_maternity?, for_response: "maternity"
+ end
+
+ should "have a next node of leave_or_pay_for_adoption? for a 'paternity' response" do
+ assert_next_node :leave_or_pay_for_adoption?, for_response: "paternity"
+ end
+
+ should "have a next node of taking_paternity_or_maternity_leave_for_adoption? for a 'adoption' response" do
+ assert_next_node :taking_paternity_or_maternity_leave_for_adoption?, for_response: "adoption"
+ end
+ end
+ end
+end
| Test core class of MaternityPaternityCalculatorFlow
This commit is the first in a series of commits to apply the ADR-3 [1]
style of flow tests to the MaternityPaternityCalculatorFlow.
This commit in particular adds tests to the one node that is defined in
MaternityPaternityCalculatorFlow. I've decided to break up the testing
of this flow into tests that match the individual files
(MaternityPaternityCalculatorFlow::AdoptionCalculatorFlow etc) that are
used to define it. I've done this as a way to try cope with the length
and complexity of the flows - as I found my initial pass, of putting
all the flow tests into a single file, created a file that was
overwhelming in length (> 2000 lines). The split isn't the easiest to
follow as all files are coupled and intertwined.
[1]: https://github.com/alphagov/smart-answers/blob/main/docs/arch/003-testing-flows.md
|
diff --git a/twigg-app/lib/twigg-app/app/quips.rb b/twigg-app/lib/twigg-app/app/quips.rb
index abc1234..def5678 100644
--- a/twigg-app/lib/twigg-app/app/quips.rb
+++ b/twigg-app/lib/twigg-app/app/quips.rb
@@ -3,10 +3,10 @@ module Twigg
module App
module Quips
- QUIPS = YAML.load_file(Twigg::App.root + 'data' + 'quips.yml')
+ QUIPS = YAML.load_file(App.root + 'data' + 'quips.yml')
def self.random
- QUIPS[rand(QUIPS.size)]
+ QUIPS.sample
end
end
end
| Apply minor tweaks to Quips module
We don't need a fully qualified namespace to access the App root, so
trim it.
Likewise, we can use Array#sample to achieve the same effects, while
avoiding getting our hands dirty with the random numbers.
Change-Id: I8909540e85477118cf2042a74e2517bb41f42c42
Reviewed-on: https://gerrit.causes.com/26198
Reviewed-by: Greg Hurrell <79e2475f81a6317276bf7cbb3958b20d289b78df@causes.com>
Tested-by: Greg Hurrell <79e2475f81a6317276bf7cbb3958b20d289b78df@causes.com>
|
diff --git a/bios_and_system.rb b/bios_and_system.rb
index abc1234..def5678 100644
--- a/bios_and_system.rb
+++ b/bios_and_system.rb
@@ -0,0 +1,30 @@+require 'facter'
+require 'facter/manufacturer'
+
+#
+# bios_and_system.rb
+#
+
+query = {
+ 'BIOS [Ii]nformation' => [
+ { 'Vendor:' => 'bios_vendor' },
+ { 'Version:' => 'bios_version' },
+ { 'Release Date:' => 'bios_release_date' },
+ { 'ROM Size:' => 'bios_rom_size' },
+ { 'BIOS Revision:' => 'bios_revision' },
+ { 'Firmware Revision' => 'bios_firmware_revision' }
+ ],
+ '[Ss]ystem [Ii]nformation' => [
+ { 'Manufacturer:' => 'system_manufacturer' },
+ { 'Product Name:' => 'system_product_name' },
+ { 'Serial Number:' => 'system_serial_number' },
+ { 'UUID:' => 'system_uuid' },
+ { 'Family(?: Name)?:' => 'system_family_name' }
+ ]
+}
+
+# We call existing helper function to do the heavy-lifting ...
+Facter::Manufacturer.dmi_find_system_info(query)
+
+# vim: set ts=2 sw=2 et :
+# encoding: utf-8
| Add Facter fact that provides rich details about BIOS and current system.
This fact increases coverage and/or details that already existing facts
provide about BIOS, manufacturer and system in general ...
Signed-off-by: Krzysztof Wilczynski <9bf091559fc98493329f7d619638c79e91ccf029@linux.com>
|
diff --git a/guides/check_typo.rb b/guides/check_typo.rb
index abc1234..def5678 100644
--- a/guides/check_typo.rb
+++ b/guides/check_typo.rb
@@ -2,9 +2,12 @@ # -*- coding: utf-8 -*-
# Cited from コードの世界 by Matz
# 典型的なスペル・ミスを探す方法, 図6 文章のミスをチェックするスクリプト
+#
+# Usage: ./check_typo.rb FILENAME
+# e.g.: ./check_typo.rb source/testing.md
ARGF.each do |line|
print ARGF.file.path, " ",
ARGF.file.lineno, ":",
- line if line.gsub!(/([へにおはがでな])\1/s, '[[\&]]')
+ line if line.gsub!(/([へにおはがでな])\1/, '[[\&]]')
end
| Fix typo and add usage/example to Check Typo script
|
diff --git a/lib/nanoc/base/services/dependency_tracker.rb b/lib/nanoc/base/services/dependency_tracker.rb
index abc1234..def5678 100644
--- a/lib/nanoc/base/services/dependency_tracker.rb
+++ b/lib/nanoc/base/services/dependency_tracker.rb
@@ -2,12 +2,17 @@ # @api private
class DependencyTracker
class Null
+ include Nanoc::Int::ContractsSupport
+
+ contract C::Or[Nanoc::Int::Item, Nanoc::Int::Layout] => C::Any
def enter(_obj)
end
+ contract C::Or[Nanoc::Int::Item, Nanoc::Int::Layout] => C::Any
def exit(_obj)
end
+ contract C::Or[Nanoc::Int::Item, Nanoc::Int::Layout] => C::Any
def bounce(_obj)
end
end
| Add contracts to null dep tracker
|
diff --git a/lib/rubycritic/source_control_systems/base.rb b/lib/rubycritic/source_control_systems/base.rb
index abc1234..def5678 100644
--- a/lib/rubycritic/source_control_systems/base.rb
+++ b/lib/rubycritic/source_control_systems/base.rb
@@ -19,13 +19,13 @@ if supported_system
supported_system.new
else
- puts "Rubycritic requires a #{system_names} repository."
+ puts "RubyCritic can provide more feedback if you use a #{connected_system_names} repository."
Double.new
end
end
- def self.system_names
- systems.join(", ")
+ def self.connected_system_names
+ "#{systems[0...-1].join(', ')} or #{systems[-1]}"
end
def self.supported?
| Improve message displayed when no SCS is found
|
diff --git a/test/unit/filters/hashtag_test.rb b/test/unit/filters/hashtag_test.rb
index abc1234..def5678 100644
--- a/test/unit/filters/hashtag_test.rb
+++ b/test/unit/filters/hashtag_test.rb
@@ -0,0 +1,25 @@+require File.expand_path('../../unit_test_helper', __FILE__)
+
+class HashtagTest < Test::Unit::TestCase
+
+ def test_transform
+ result = auto_html("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec vel ipsum et leo adipiscing ultrices. Etiam ac elementum cras amet. #LoremIpsum") { hashtag }
+ assert_equal 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec vel ipsum et leo adipiscing ultrices. Etiam ac elementum cras amet. <a href="http://twitter.com/search?q=%23LoremIpsum&f=realtime" class="hashtag" target="_blank">#LoremIpsum</a>', result
+ end
+
+ def test_transform_with_multiple_hashtags
+ result = auto_html("Lorem ipsum #dolor sit amet, consectetur adipiscing elit. Donec vel ipsum et leo #adipiscingUltrices. Etiam ac elementum cras amet.") { hashtag }
+ assert_equal 'Lorem ipsum <a href="http://twitter.com/search?q=%23dolor&f=realtime" class="hashtag" target="_blank">#dolor</a> sit amet, consectetur adipiscing elit. Donec vel ipsum et leo <a href="http://twitter.com/search?q=%23adipiscingUltrices.&f=realtime" class="hashtag" target="_blank">#adipiscingUltrices.</a> Etiam ac elementum cras amet.', result
+ end
+
+ def test_transform_with_twitter_source
+ result = auto_html("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec vel ipsum et leo adipiscing ultrices. Etiam ac elementum cras amet. #LoremIpsum") { hashtag source: :twitter }
+ assert_equal 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec vel ipsum et leo adipiscing ultrices. Etiam ac elementum cras amet. <a href="http://twitter.com/search?q=%23LoremIpsum&f=realtime" class="hashtag" target="_blank">#LoremIpsum</a>', result
+ end
+
+ def test_transform_with_facebook_source
+ result = auto_html("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec vel ipsum et leo adipiscing ultrices. Etiam ac elementum cras amet. #LoremIpsum") { hashtag source: :facebook }
+ assert_equal 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec vel ipsum et leo adipiscing ultrices. Etiam ac elementum cras amet. <a href="https://www.facebook.com/hashtag/LoremIpsum" class="hashtag" target="_blank">#LoremIpsum</a>', result
+ end
+
+end
| Add tests for hashtag filter
|
diff --git a/lib/hanzo/heroku.rb b/lib/hanzo/heroku.rb
index abc1234..def5678 100644
--- a/lib/hanzo/heroku.rb
+++ b/lib/hanzo/heroku.rb
@@ -4,15 +4,13 @@ class << self
def available_labs
- labs = []
-
- `bundle exec heroku labs`.each_line do |line|
- next unless line = /^\[\s\]\s+(?<name>\w+)\s+(?<description>.+)$/.match(line)
-
- labs << [line[:name], line[:description]]
+ `bundle exec heroku labs`.each_line.to_a.inject([]) do |memo, line|
+ if line = /^\[\s\]\s+(?<name>\w+)\s+(?<description>.+)$/.match(line)
+ memo << [line[:name], line[:description]]
+ else
+ memo
+ end
end
-
- labs
end
end
| Use good old inject for Labs listing
|
diff --git a/lib/hashid/rails.rb b/lib/hashid/rails.rb
index abc1234..def5678 100644
--- a/lib/hashid/rails.rb
+++ b/lib/hashid/rails.rb
@@ -2,6 +2,35 @@
module Hashid
module Rails
- # Your code goes here...
+ extend ActiveSupport::Concern
+
+ class_methods do
+ def hashids
+ Hashids.new(table_name, 6)
+ end
+
+ def encode_id(id)
+ hashids.encode(id)
+ end
+
+ def decode_id(id)
+ hashids.decode(id).first
+ end
+
+ def hashid_find(hashid)
+ find(decode_id(hashid))
+ end
+ end
+
+ def encoded_id
+ self.class.encode_id(id)
+ end
+
+ def to_param
+ encoded_id
+ end
+ alias_method :hashid, :to_param
end
end
+
+ActiveRecord::Base.send :include, Hashid::Rails
| Add hashid methods to ActiveRecord::Base
|
diff --git a/app/helpers/groups_helper.rb b/app/helpers/groups_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/groups_helper.rb
+++ b/app/helpers/groups_helper.rb
@@ -4,7 +4,7 @@ if person == nil
true
else
- person.group_id != group.id
+ Membership.pluck(:group_id).include?(group.id) == false
end
end
@@ -12,7 +12,7 @@ if person == nil
false
else
- person.group_id == group.id
+ Membership.pluck(:group_id).include?(group.id) == true
end
end
end
| Change how group_id is found based on membership |
diff --git a/app/views/course/survey/surveys/results.json.jbuilder b/app/views/course/survey/surveys/results.json.jbuilder
index abc1234..def5678 100644
--- a/app/views/course/survey/surveys/results.json.jbuilder
+++ b/app/views/course/survey/surveys/results.json.jbuilder
@@ -22,7 +22,7 @@ if question.text?
json.(answer, :text_response)
else
- json.selected_options answer.options.select(&:selected).map(&:question_option_id)
+ json.selected_options answer.options.map(&:question_option_id)
end
end
end
| Update survey results JSON data
|
diff --git a/lib/woodhouse/dispatchers/bunny_dispatcher.rb b/lib/woodhouse/dispatchers/bunny_dispatcher.rb
index abc1234..def5678 100644
--- a/lib/woodhouse/dispatchers/bunny_dispatcher.rb
+++ b/lib/woodhouse/dispatchers/bunny_dispatcher.rb
@@ -52,7 +52,7 @@ def new_pool
@bunny.stop if @bunny
- bunny = @bunny = Bunny.new((@config.server_info || {}).merge(:threaded => false))
+ bunny = @bunny = Bunny.new(@config.server_info || {})
@bunny.start
ConnectionPool.new { bunny.create_channel }
| Revert "Turn off threading in Bunny dispatcher because it doesn't gain us anything and it appears to gobble memory."
This reverts commit 27facf66375b92bad8c5bd56491691f843d7ead3.
|
diff --git a/em-jack.gemspec b/em-jack.gemspec
index abc1234..def5678 100644
--- a/em-jack.gemspec
+++ b/em-jack.gemspec
@@ -15,7 +15,7 @@
s.required_rubygems_version = '>= 1.3.6'
- s.add_dependency 'eventmachine', ['>= 1.0.0.beta.3']
+ s.add_dependency 'eventmachine', ['>= 0.12.10']
s.add_development_dependency 'bundler', ['~> 1.0.13']
s.add_development_dependency 'rake', ['~> 0.8.7']
| Use older EventMachine for now
The usage of >= should allow projects using more recent versions to
coexist with em-jack.
|
diff --git a/webapp/script/core_fields_updater.rb b/webapp/script/core_fields_updater.rb
index abc1234..def5678 100644
--- a/webapp/script/core_fields_updater.rb
+++ b/webapp/script/core_fields_updater.rb
@@ -0,0 +1,32 @@+@dry_run = ARGV.shift == "--dry-run"
+
+core_fields = YAML.load(IO.read(RAILS_ROOT + "/db/defaults/core_fields.yml"))
+
+core_fields.collect do |k, v|
+ db_record = CoreField.find_by_name_and_event_type(v['name'], v['event_type'])
+ if db_record.nil?
+ db_record = CoreField.find_by_key(v['key'])
+ if db_record.nil?
+ CoreField.create(v) unless @dry_run
+ "* Created new core field: #{v['event_type']} field named '#{v['name']} with key #{v['key'].gsub('[', '\[').gsub(']', '\]')}"
+ else
+ db_record.update_attribute(:name, v['name']) unless @dry_run
+ "* Renamed #{v['event_type']}: '#{db_record.name}' to '#{v['name']}'"
+ end
+ elsif v['key'] != db_record.key
+ old_key = db_record.key
+ message = ""
+ message << "* Reset core field #{v['event_type']}:'#{v['name']}' key from #{old_key.gsub('[', '\[').gsub(']', '\]')} to #{v['key'].gsub('[', '\[').gsub(']', '\]')}\n"
+ forms = []
+ FormElement.find_all_by_core_path(old_key).each do |element|
+ forms << "** Updated elements of form #{element.form.name}"
+ end
+ unless @dry_run
+ CoreField.transaction do
+ db_record.update_attribute :key, v['key']
+ FormElement.update_all("core_path='#{v['key']}'", "core_path = '#{old_key}'")
+ end
+ end
+ message << forms.uniq.join("\n")
+ end
+end.compact.sort.each {|a| puts a}
| Add a script that checks the core_fields table for broken keys and
tries to fix them.
./script/runner script/core_fields_updater.rb
Fixes the core_fields
and outputs a list of field changes and any formbuilder forms that may
have been impacted.
./script/runner script/core_fields_updater.rb --dry-run
Only ouputs the list of changes that would be made and impacted
forms. Nothing is changed in the database.
|
diff --git a/lib/rollbar/json.rb b/lib/rollbar/json.rb
index abc1234..def5678 100644
--- a/lib/rollbar/json.rb
+++ b/lib/rollbar/json.rb
@@ -43,7 +43,7 @@ def find_options_module
module_name = multi_json_adapter_module_name
- if constants.find{ |const| const.to_s == module_name }
+ if const_defined?("::Rollbar::JSON::#{module_name}")
const_get(module_name)
else
Default
| Use const_defined? with full name instead. Thanks @jondeandres
|
diff --git a/lib/rrj/rabbitmq.rb b/lib/rrj/rabbitmq.rb
index abc1234..def5678 100644
--- a/lib/rrj/rabbitmq.rb
+++ b/lib/rrj/rabbitmq.rb
@@ -0,0 +1,18 @@+# frozen_string_literal: true
+
+require 'bunny'
+
+module RRJ
+ # Class for connection with RabbitMQ Server
+ class Rabbit
+ attr_reader :connection, :logs, :settings
+
+ def initialize(configuration, logs)
+ @settings = configuration
+ @logs = logs
+
+ @logs.write 'Prepare connection with RabbitMQ server'
+ @logs.write @settings.inspect
+ end
+ end
+end
| Add file for communicate with RabbitMQ
|
diff --git a/examples/overwrite_conf.rb b/examples/overwrite_conf.rb
index abc1234..def5678 100644
--- a/examples/overwrite_conf.rb
+++ b/examples/overwrite_conf.rb
@@ -0,0 +1,12 @@+def ext_config()
+ puts "Own Config loading and overwriting default settings!"
+ @overwrite = {
+ mumbleserver_host: "domain_or_ip_of_your_mumbleserver",
+ mumbleserver_port: 64738,
+ mumbleserver_username: "Name_of_your_bot",
+ mumbleserver_targetchannel: "Bottest",
+ mpd_fifopath: "/home/botmaster/mpd1/mpd.fifo",
+ mpd_port: 7701,
+ }
+ @settings = @settings.merge(@overwrite)
+end
| Add example for config which overwrites only few default values
|
diff --git a/core/spec/requests/admin/configuration/states_spec.rb b/core/spec/requests/admin/configuration/states_spec.rb
index abc1234..def5678 100644
--- a/core/spec/requests/admin/configuration/states_spec.rb
+++ b/core/spec/requests/admin/configuration/states_spec.rb
@@ -21,6 +21,7 @@
context "creating and editing states" do
it "should allow an admin to edit existing states", :js => true do
+ pending "Need to investigate this failing spec on Travis causing false-negatives randomly on 1-1-stable and master"
click_link "States"
select country.name, :from => "country"
click_link "new_state_link"
| Make randomly failing configuration/states spec pending until Travis can be figured out
|
diff --git a/lib/autotest/discover.rb b/lib/autotest/discover.rb
index abc1234..def5678 100644
--- a/lib/autotest/discover.rb
+++ b/lib/autotest/discover.rb
@@ -1,3 +1,9 @@ Autotest.add_discovery do
- "cucumber" if ENV['AUTOFEATURE'] == 'true' && File.directory?('features')
+ if File.directory?('features')
+ if ENV['AUTOFEATURE'] == 'true'
+ "cucumber"
+ else
+ puts "(Not running features. To run features in autotest, set AUTOFEATURE=true.)"
+ end
+ end
end
| Add warning when AUTOFEATURE is disabled.
|
diff --git a/lib/be_gateway/client.rb b/lib/be_gateway/client.rb
index abc1234..def5678 100644
--- a/lib/be_gateway/client.rb
+++ b/lib/be_gateway/client.rb
@@ -4,6 +4,7 @@ module BeGateway
class Client
cattr_accessor :rack_app
+ cattr_accessor :rack_app, :stub_app
def initialize(params)
@login = params[:shop_id]
@@ -49,6 +50,7 @@
conn.response :json
+ conn.adapter :test, stub_app if stub_app
conn.adapter :rack, rack_app.new if rack_app
end
end
| Add stub_app adapter for test stub in apps
|
diff --git a/lib/cloudstrap/amazon.rb b/lib/cloudstrap/amazon.rb
index abc1234..def5678 100644
--- a/lib/cloudstrap/amazon.rb
+++ b/lib/cloudstrap/amazon.rb
@@ -1,3 +1,4 @@ require_relative 'amazon/ec2'
+require_relative 'amazon/elb'
require_relative 'amazon/iam'
require_relative 'amazon/route53'
| Add ELB to require wrapper
|
diff --git a/lib/malt/engines/rdoc.rb b/lib/malt/engines/rdoc.rb
index abc1234..def5678 100644
--- a/lib/malt/engines/rdoc.rb
+++ b/lib/malt/engines/rdoc.rb
@@ -31,6 +31,7 @@ def initialize_engine
return if defined?(::RDoc::Markup)
require 'rubygems' # hack
+ require_library 'rdoc'
require_library 'rdoc/markup'
require_library 'rdoc/markup/to_html'
end
| Make sure RDoc being loaded.
|
diff --git a/lib/pug/worker/daemon.rb b/lib/pug/worker/daemon.rb
index abc1234..def5678 100644
--- a/lib/pug/worker/daemon.rb
+++ b/lib/pug/worker/daemon.rb
@@ -15,14 +15,14 @@ private
def start
- daemonize if configuration.daemonize?
+ daemonize if daemonize?
trap_signals
- create_pid_file
+ create_pid_file if pid_path
application.start
end
def stop
- delete_pid_file
+ delete_pid_file if pid_path
application.stop
end
@@ -58,11 +58,19 @@ end
def pid_file
- @pid_file ||= PidFile.new configuration.pid_path
+ @pid_file ||= PidFile.new pid_path
end
def pid
Process.pid
+ end
+
+ def pid_path
+ configuration.pid_path
+ end
+
+ def daemonize?
+ configuration.daemonize?
end
def configuration
| Make pid path configuration optional
|
diff --git a/lib/rancher/shell/cli.rb b/lib/rancher/shell/cli.rb
index abc1234..def5678 100644
--- a/lib/rancher/shell/cli.rb
+++ b/lib/rancher/shell/cli.rb
@@ -7,8 +7,8 @@ class CLI < Thor
desc "exec [COMMAND]", "Execute a command within a docker container"
- option :project
- option :container
+ option :project, required: true
+ option :container, required: true
def exec command
Config.load(
'project' => options[:project],
@@ -33,6 +33,27 @@ print "\n"
end
end
+
+ desc "list-containers", "List all containers available within a project"
+ option :project, required: true
+ def list_containers
+ Config.load
+ projects = Config.get('projects')
+ project = projects.find { |_| _['id'] == options[:project] }
+ api = Rancher::Shell::Api.new(
+ host: project['api']['host'],
+ user: project['api']['key'],
+ pass: project['api']['secret'],
+ )
+ containers = api.get('containers?state=running').json['data']
+ containers.each do |container|
+ print container['id'].ljust 12
+ print container['state'].ljust 12
+ print container['name'].ljust 40
+ print container['ports'] if container['ports'] && container['ports'] != ''
+ print "\n"
+ end
+ end
end
end
end
| Add command for listing running containers
|
diff --git a/lib/sparkle_formation.rb b/lib/sparkle_formation.rb
index abc1234..def5678 100644
--- a/lib/sparkle_formation.rb
+++ b/lib/sparkle_formation.rb
@@ -18,7 +18,7 @@
require 'attribute_struct'
-module SparkleFormation
+class SparkleFormation
autoload :Aws, 'sparkle_formation/aws'
autoload :SparkleAttribute, 'sparkle_formation/sparkle_attribute'
autoload :SparkleFormation, 'sparkle_formation/sparkle_formation'
| Use correct type on declaration
|
diff --git a/lib/wicket-sdk/client.rb b/lib/wicket-sdk/client.rb
index abc1234..def5678 100644
--- a/lib/wicket-sdk/client.rb
+++ b/lib/wicket-sdk/client.rb
@@ -37,6 +37,14 @@ end
end
+ def alive
+ connection.run(:head, '/').status
+ end
+
+ def alive?
+ alive == 200
+ end
+
private
def reset_connection
| Add helper method for checking if the api connection alive and valid.
|
diff --git a/lib/zen/plugin/helper.rb b/lib/zen/plugin/helper.rb
index abc1234..def5678 100644
--- a/lib/zen/plugin/helper.rb
+++ b/lib/zen/plugin/helper.rb
@@ -30,13 +30,11 @@ whitelist = [whitelist]
end
- name = name.to_s
- classes = whitelist.join(' or ').to_s
-
if !whitelist.include?(variable.class)
raise(
TypeError,
- "\"#{name}\" can only be an instance of #{classes} but got #{variable.class}"
+ "\"#{name}\" can only be an instance of #{whitelist.join(' or ')} " \
+ "but got #{variable.class}"
)
end
end
| Remove some useless code from Zen::Plugin::Helper. |
diff --git a/lib/tasks/beso.rake b/lib/tasks/beso.rake
index abc1234..def5678 100644
--- a/lib/tasks/beso.rake
+++ b/lib/tasks/beso.rake
@@ -25,9 +25,11 @@ csv = job.to_csv :since => config[ job.event ]
if csv
- bucket.write "#{job.event}-#{config[ job.event ].to_i}.csv", csv
+ filename = "beso-#{job.event}-#{config[ job.event ].to_i}.csv"
- puts " ==> #{job.event}-#{config[ job.event ].to_i}.csv saved to S3"
+ bucket.write filename, csv
+
+ puts " ==> #{filename} saved to S3"
config[ job.event ] = job.last_timestamp
| Make sure to prefix the filename saved to s3
|
diff --git a/lib/tent-schemas.rb b/lib/tent-schemas.rb
index abc1234..def5678 100644
--- a/lib/tent-schemas.rb
+++ b/lib/tent-schemas.rb
@@ -27,4 +27,16 @@ def schema
{ 'schemas' => schemas }
end
+
+ def inject_refs!(hash)
+ hash.each_pair do |key, val|
+ if Hash === val
+ if val["$ref"]
+ hash[key] = schemas[val["$ref"].sub(/\A#\/schemas\//, '')]
+ else
+ inject_refs!(val)
+ end
+ end
+ end
+ end
end
| Add TentSchemas.inject_refs method to inject referenced schemas
|
diff --git a/capistrano.gemspec b/capistrano.gemspec
index abc1234..def5678 100644
--- a/capistrano.gemspec
+++ b/capistrano.gemspec
@@ -11,8 +11,7 @@ automate the deployment of web applications.
DESC
- s.files = Dir.glob("{bin,lib,examples,test}/**/*")
- s.files.concat %w(README MIT-LICENSE ChangeLog)
+ s.files = Dir.glob("{bin,lib,examples,test}/**/*") + %w(README MIT-LICENSE CHANGELOG THANKS)
s.require_path = 'lib'
s.autorequire = 'capistrano'
| Fix gemspec to include license file, etc.
git-svn-id: 9d685678486d2699cf6cf82c17578cbe0280bb1f@4832 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
|
diff --git a/actionpack/lib/action_dispatch/middleware/request_id.rb b/actionpack/lib/action_dispatch/middleware/request_id.rb
index abc1234..def5678 100644
--- a/actionpack/lib/action_dispatch/middleware/request_id.rb
+++ b/actionpack/lib/action_dispatch/middleware/request_id.rb
@@ -1,5 +1,6 @@ require 'securerandom'
require 'active_support/core_ext/string/access'
+require 'active_support/core_ext/object/blank'
module ActionDispatch
# Makes a unique request id available to the action_dispatch.request_id env variable (which is then accessible through
@@ -26,8 +27,8 @@
private
def external_request_id(env)
- if env["HTTP_X_REQUEST_ID"].present?
- env["HTTP_X_REQUEST_ID"].gsub(/[^\w\d\-]/, "").first(255)
+ if request_id = env["HTTP_X_REQUEST_ID"].presence
+ request_id.gsub(/[^\w\d\-]/, "").first(255)
end
end
| Load object/blank and make use of presence.
|
diff --git a/app/models/spree/calculator/related_product_discount.rb b/app/models/spree/calculator/related_product_discount.rb
index abc1234..def5678 100644
--- a/app/models/spree/calculator/related_product_discount.rb
+++ b/app/models/spree/calculator/related_product_discount.rb
@@ -3,7 +3,7 @@ preference :item_total_threshold, :decimal, default: 5
def self.description
- Spree.t("related_product_discount")
+ Spree.t(:related_product_discount)
end
def compute(object)
@@ -16,7 +16,7 @@
return unless eligible?(order)
total = order.line_items.inject(0) do |total, line_item|
- relations = Spree::Relation.where("discount_amount <> 0.0 AND relatable_type = ? AND relatable_id = ?", "Spree::Product", line_item.variant.product.id)
+ relations = Spree::Relation.where(*discount_query(line_item))
discount_applies_to = relations.map {|rel| rel.related_to.master }
order.line_items.each do |li|
@@ -37,7 +37,17 @@ end
def eligible?(order)
- order.line_items.any? { |line_item| Spree::Relation.exists?(["discount_amount <> 0.0 AND relatable_type = ? AND relatable_id = ?", "Spree::Product", line_item.variant.product.id])}
+ order.line_items.any? do |line_item|
+ Spree::Relation.exists?(discount_query(line_item))
+ end
+ end
+
+ def discount_query(line_item)
+ [
+ 'discount_amount <> 0.0 AND relatable_type = ? AND relatable_id = ?',
+ 'Spree::Product',
+ line_item.variant.product.id
+ ]
end
end
end
| Move calculator dup query into own method.
|
diff --git a/db/migrate/20160418141210_add_read_only_to_miq_alert.rb b/db/migrate/20160418141210_add_read_only_to_miq_alert.rb
index abc1234..def5678 100644
--- a/db/migrate/20160418141210_add_read_only_to_miq_alert.rb
+++ b/db/migrate/20160418141210_add_read_only_to_miq_alert.rb
@@ -1,6 +1,9 @@ class AddReadOnlyToMiqAlert < ActiveRecord::Migration[5.0]
+ class MiqAlert < ActiveRecord::Base; end
+
def up
add_column :miq_alerts, :read_only, :boolean
+
say_with_time('Add read only parameter to MiqAlert with true for OOTB alerts') do
guids = YAML.load_file(Rails.root.join("db/fixtures/miq_alerts.yml")).map { |h| h["guid"] || h[:guid] }
MiqAlert.where(:guid => guids).update(:read_only => true)
| Add stub for model MiqAlert
|
diff --git a/spec/features/creating_posts_validations_spec.rb b/spec/features/creating_posts_validations_spec.rb
index abc1234..def5678 100644
--- a/spec/features/creating_posts_validations_spec.rb
+++ b/spec/features/creating_posts_validations_spec.rb
@@ -32,6 +32,6 @@ fill_in 'Content', with: "a"
click_button "Create Post"
visit '/posts/'
- page.should_not have_content (char *4)
+ expect(page).not_to have_content (char *4)
end
end
| Use expect not syntax with validations spec/passing
|
diff --git a/spec/helpers/seo_meta_description_helper_spec.rb b/spec/helpers/seo_meta_description_helper_spec.rb
index abc1234..def5678 100644
--- a/spec/helpers/seo_meta_description_helper_spec.rb
+++ b/spec/helpers/seo_meta_description_helper_spec.rb
@@ -10,15 +10,14 @@ it 'returns meta description for default description option' do
allow(helper).to receive(:content_for).with(:description)
.and_return('Meta description')
- expect(helper.seo_meta_description)
- .to eq '<meta name="description" content="Meta description" />'
+ expect(helper.seo_meta_description).to include 'content="Meta description'
end
it 'returns meta description for custom description option' do
allow(helper).to receive(:content_for).with(:meta_description)
.and_return('Meta description')
expect(helper.seo_meta_description(description: :meta_description))
- .to eq '<meta name="description" content="Meta description" />'
+ .to include 'content="Meta description'
end
end
end
| Fix for consistency between supported Ruby and Rails versions
|
diff --git a/spec/requests/carto/api/users_controller_spec.rb b/spec/requests/carto/api/users_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/requests/carto/api/users_controller_spec.rb
+++ b/spec/requests/carto/api/users_controller_spec.rb
@@ -30,5 +30,11 @@ expect(response.body[:organization_notifications]).to eq(organization_notifications)
end
end
+
+ it 'returns 401 if user is not logged in' do
+ get_json api_v3_users_me_url, @headers do |response|
+ expect(response.status).to eq(401)
+ end
+ end
end
end
| Test for /me requests without user logged in
|
diff --git a/config/initializers/oink.rb b/config/initializers/oink.rb
index abc1234..def5678 100644
--- a/config/initializers/oink.rb
+++ b/config/initializers/oink.rb
@@ -1 +1 @@-Rails.application.middleware.use(Oink::Middleware, logger: Rails.logger)
+Rails.application.middleware.use(Oink::Middleware, logger: Hodel3000CompliantLogger.new(STDOUT))
| Use Hodel3000CompliantLogger instead of Rails.logger on Oink
|
diff --git a/spec/models/setup/handlebars_template_spec.rb b/spec/models/setup/handlebars_template_spec.rb
index abc1234..def5678 100644
--- a/spec/models/setup/handlebars_template_spec.rb
+++ b/spec/models/setup/handlebars_template_spec.rb
@@ -0,0 +1,97 @@+require 'rails_helper'
+
+describe Setup::HandlebarsTemplate do
+
+ test_namespace = 'Handlebars Template Test'
+
+ simple_test_name = 'Simple Test'
+ bulk_test_name = 'Bulk Test'
+
+ before :all do
+ Setup::HandlebarsTemplate.create!(
+ namespace: test_namespace,
+ name: simple_test_name,
+ code: "Hello {{first_name}} {{last_name}}!"
+ )
+
+ Setup::HandlebarsTemplate.create!(
+ namespace: test_namespace,
+ name: bulk_test_name,
+ bulk_source: true,
+ code: "{{#each_source}}[{{first_name}} {{last_name}}]{{/each_source}}"
+ )
+ end
+
+ let! :simple_test do
+ Setup::HandlebarsTemplate.where(namespace: test_namespace, name: simple_test_name).first
+ end
+
+ let! :simple_source do
+ Setup::JsonDataType.new(
+ namespace: test_namespace,
+ name: 'Simple Source',
+ schema: {
+ type: 'object',
+ properties: {
+ first_name: {
+ type: 'string'
+ },
+ last_name: {
+ type: 'string'
+ }
+ }
+ }
+ ).new_from(first_name: 'CENIT', last_name: 'IO')
+ end
+
+ let! :bulk_test do
+ Setup::HandlebarsTemplate.where(namespace: test_namespace, name: bulk_test_name).first
+ end
+
+ let! :bulk_source do
+ dt = Setup::JsonDataType.new(
+ namespace: test_namespace,
+ name: 'Simple Source',
+ schema: {
+ type: 'object',
+ properties: {
+ first_name: {
+ type: 'string'
+ },
+ last_name: {
+ type: 'string'
+ }
+ }
+ }
+ )
+
+ [
+ dt.new_from(first_name: 'Albert', last_name: 'Einstein'),
+ dt.new_from(first_name: 'Pablo', last_name: 'Picasso'),
+ dt.new_from(first_name: 'Aretha', last_name: 'Franklin'),
+ dt.new_from(first_name: 'CENIT', last_name: 'IO')
+ ]
+ end
+
+ context "simple source template" do
+
+ it "renders handlebar template" do
+ result = simple_test.run(source: simple_source)
+
+ expect(result).to eq('Hello CENIT IO!')
+ end
+ end
+
+ context "bulk source template" do
+
+ it "renders handlebar template" do
+ result = bulk_test.run(sources: bulk_source)
+
+ expected = bulk_source.map do |source|
+ "[#{source.first_name} #{source.last_name}]"
+ end.join('')
+
+ expect(result).to eq(expected)
+ end
+ end
+end
| Add | Handlebars template tests
|
diff --git a/spec/support/request_helpers/event_logging.rb b/spec/support/request_helpers/event_logging.rb
index abc1234..def5678 100644
--- a/spec/support/request_helpers/event_logging.rb
+++ b/spec/support/request_helpers/event_logging.rb
@@ -34,15 +34,6 @@ do_request
expect(Event.count).to eq(0)
- expect(response.status).to eq(422)
-
- parsed_response = JSON.parse(response.body).deep_symbolize_keys
-
- expect(parsed_response).to have_key(:error)
- parsed_error = parsed_response.fetch(:error)
-
- expect(parsed_error[:code]).to eq(422)
- expect(parsed_error[:fields]).to eq(error_details.fetch(:errors))
end
end
end
| Remove overly specific assertions in event logging test helpers.
|
diff --git a/database_cleaner_seeded.gemspec b/database_cleaner_seeded.gemspec
index abc1234..def5678 100644
--- a/database_cleaner_seeded.gemspec
+++ b/database_cleaner_seeded.gemspec
@@ -2,7 +2,7 @@
Gem::Specification.new do |s|
s.name = 'database_cleaner_seeded'
- s.version = '0.1.3'
+ s.version = '0.1.4'
s.date = '2016-08-09'
s.summary = 'Seed database directly between feature tests'
s.description = 'Provide a strategy for injecting database seeds between feature tests, using the DBMS directly.'
@@ -10,7 +10,7 @@ s.email = 'email.michaeldawson@gmail.com'
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
- s.homepage = 'http://rubygems.org/gems/database_cleaner_seeded'
+ s.homepage = 'https://github.com/michaeldawson/database_cleaner_seeded'
s.license = 'MIT'
s.add_dependency('database_cleaner', '>= 1.2.0')
| Set homepage to github in gemspec
|
diff --git a/zencoder.gemspec b/zencoder.gemspec
index abc1234..def5678 100644
--- a/zencoder.gemspec
+++ b/zencoder.gemspec
@@ -18,7 +18,6 @@ s.add_dependency "json_pure"
s.add_development_dependency "shoulda"
s.add_development_dependency "mocha"
- s.add_development_dependency "typhoeus"
s.add_development_dependency "webmock"
s.files = Dir.glob("lib/**/*") + %w(LICENSE README.markdown Rakefile)
s.require_path = 'lib'
| Remove typhoeus as a development dependency
|
diff --git a/Library/Homebrew/test/utils/livecheck_formula_spec.rb b/Library/Homebrew/test/utils/livecheck_formula_spec.rb
index abc1234..def5678 100644
--- a/Library/Homebrew/test/utils/livecheck_formula_spec.rb
+++ b/Library/Homebrew/test/utils/livecheck_formula_spec.rb
@@ -1,14 +1,17 @@ # frozen_string_literal: true
require "utils/livecheck_formula"
+require "formula_installer"
describe LivecheckFormula do
- describe "init", :integration_test do
+ describe "init" do
+ let(:f) { formula { url "foo-1.0" } }
+ let(:options) { FormulaInstaller.new(f).display_options(f) }
+ let(:action) { "#{f.full_name} #{options}".strip }
+
it "runs livecheck command for Formula" do
- install_test_formula "testball"
-
- formatted_response = described_class.init("testball")
-
+ formatted_response = described_class.init(action)
+
expect(formatted_response).not_to be_nil
expect(formatted_response).to be_a(Hash)
expect(formatted_response.size).not_to eq(0)
| Refactor how test formulas are installed in tests
|
diff --git a/listener.rb b/listener.rb
index abc1234..def5678 100644
--- a/listener.rb
+++ b/listener.rb
@@ -0,0 +1,73 @@+require 'listen'
+
+module Moltrio
+ module Config
+ module Listener
+
+ def self.listen_fs_changes
+ return if defined?(@fs_listeners)
+
+ client_config_callback = ->(modified, added, removed) {
+ all_changes = (modified + added + removed)
+
+ all_changes.each do |config_path|
+ config_name = Pathname(config_path).parent.basename.to_s
+ Moltrio::Config.evict_cache_for(config_name)
+ end
+ }
+
+ global_config_callback = ->(*) {
+ Moltrio::Config.evict_all_caches
+ }
+
+ @fs_listeners = [
+ Listen.to("clients/", only: /config.yml\z/, &client_config_callback),
+ Listen.to("config/moltrio/", &global_config_callback),
+ ]
+
+ @fs_listeners.each(&:start)
+
+ self
+ end
+
+ def self.listen_etcd_changes
+ return if defined?(@etcd_listener)
+
+ etcd_host = Moltrio.etcd_host
+ etcd_port = Moltrio.etcd_port
+
+ url = "http://#{etcd_host}:#{etcd_port}/v2/keys/moltrio".freeze
+
+ @etcd_listener = Thread.new do
+ Thread.current.abort_on_exception = true
+
+ loop do
+ begin
+ response = HTTParty.get(url, query: { wait: true, recursive: true })
+ changed_config_name = response["node"]["key"].split("/")[-2]
+
+ if changed_config_name == "global_config"
+ Moltrio::Config.evict_all_caches
+ else
+ Moltrio::Config.evict_cache_for(changed_config_name)
+ end
+ rescue Net::ReadTimeout, Net::OpenTimeout
+ next
+ end
+ end
+ end
+
+ self
+ end
+
+ class << self
+ if Moltrio.etcd_configured?
+ alias_method :start, :listen_etcd_changes
+ else
+ alias_method :start, :listen_fs_changes
+ end
+ end
+
+ end
+ end
+end
| Implement configuration caching and dynamic reloading
|
diff --git a/core/dir/home_spec.rb b/core/dir/home_spec.rb
index abc1234..def5678 100644
--- a/core/dir/home_spec.rb
+++ b/core/dir/home_spec.rb
@@ -16,7 +16,7 @@
platform_is_not :windows do
it "returns the named user's home directory as a string if called with an argument" do
- Dir.home(ENV['USER']).should == home_directory
+ Dir.home(ENV['USER']).should == ENV['HOME']
end
end
| Simplify expectation as it only tests on non-Windows
|
diff --git a/rspec-hanami.gemspec b/rspec-hanami.gemspec
index abc1234..def5678 100644
--- a/rspec-hanami.gemspec
+++ b/rspec-hanami.gemspec
@@ -20,7 +20,7 @@ spec.require_paths = ["lib"]
spec.add_dependency "rspec"
- spec.add_dependency "hanami"
+ spec.add_dependency "hanami", "~> 1.0"
spec.add_dependency "hanami-model"
spec.add_development_dependency "bundler", "~> 1.11"
| Fix hanami version to 1.0
|
diff --git a/test/unit/helpers/pages_helper_test.rb b/test/unit/helpers/pages_helper_test.rb
index abc1234..def5678 100644
--- a/test/unit/helpers/pages_helper_test.rb
+++ b/test/unit/helpers/pages_helper_test.rb
@@ -10,7 +10,7 @@ setup do
@rubygem = create(:rubygem, name: "rubygems-update")
@version_first = create(:version, number: "1.4.8", rubygem: @rubygem)
- @version_last = create(:version, number: "2.4.8", built_at: DateTime.new(2015,1,1), rubygem: @rubygem)
+ @version_last = create(:version, number: "2.4.8", built_at: DateTime.new(2015, 1, 1), rubygem: @rubygem)
end
should "return latest rubygem release version number" do
| Add missing spaces after commas
Apply style rules to https://github.com/rubygems/rubygems.org/pull/996.
|
diff --git a/app/models/user_session.rb b/app/models/user_session.rb
index abc1234..def5678 100644
--- a/app/models/user_session.rb
+++ b/app/models/user_session.rb
@@ -3,7 +3,7 @@ pds_url Settings.pds.login_url
redirect_logout_url Settings.pds.logout_url
aleph_url Exlibris::Aleph::Config.base_url
- calling_system "umlaut"
+ calling_system "getit"
institution_param_key "umlaut.institution"
# (Re-)Set verification and Aleph permissions to user attributes
| Use getit name for PDS :sunflower:
|
diff --git a/test/cookbooks/python-webapp-test/metadata.rb b/test/cookbooks/python-webapp-test/metadata.rb
index abc1234..def5678 100644
--- a/test/cookbooks/python-webapp-test/metadata.rb
+++ b/test/cookbooks/python-webapp-test/metadata.rb
@@ -8,3 +8,6 @@
depends 'python-webapp'
depends 'yum'
+depends 'yum-epel'
+depends 'yum-ius'
+depends 'yum-osuosl'
| Add epel and ius cookbook dependencies
|
diff --git a/app/helpers/budget_investments_helper.rb b/app/helpers/budget_investments_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/budget_investments_helper.rb
+++ b/app/helpers/budget_investments_helper.rb
@@ -1,6 +1,8 @@ module BudgetInvestmentsHelper
def budget_investments_sorting_options
- Budget::Investment::SORTING_OPTIONS.map { |so| [t("admin.budget_investments.index.sort_by.#{so}"), so] }
+ Budget::Investment::SORTING_OPTIONS.map do |so|
+ [t("admin.budget_investments.index.sort_by.#{so}"), so]
+ end
end
def budget_investments_advanced_filters(params)
| Fix line length at budget investments helper
|
diff --git a/app/models/fe/concerns/answer_concern.rb b/app/models/fe/concerns/answer_concern.rb
index abc1234..def5678 100644
--- a/app/models/fe/concerns/answer_concern.rb
+++ b/app/models/fe/concerns/answer_concern.rb
@@ -10,9 +10,6 @@ belongs_to :question, :class_name => "Element", :foreign_key => "question_id"
before_save :set_value_from_filename
-
- has_attached_file :attachment
- do_not_validate_attachment_file_type :attachment # these attachments can be any content type
end
rescue ActiveSupport::Concern::MultipleIncludedBlocks
end
| Revert "add attachment back to answer, panorama uses it"
This reverts commit 048a14c1683181b9707847399dbc58716bc38ae7.
|
diff --git a/app/models/users/blocked_email_domain.rb b/app/models/users/blocked_email_domain.rb
index abc1234..def5678 100644
--- a/app/models/users/blocked_email_domain.rb
+++ b/app/models/users/blocked_email_domain.rb
@@ -28,4 +28,4 @@ errors.add(:domain, 'must be a domain')
end
end
-end+end
| Add missing newline at EOF
|
diff --git a/BlocksKit.podspec b/BlocksKit.podspec
index abc1234..def5678 100644
--- a/BlocksKit.podspec
+++ b/BlocksKit.podspec
@@ -6,12 +6,12 @@ s.homepage = 'https://github.com/zwaldowski/BlocksKit'
s.author = { 'Zachary Waldowski' => 'zwaldowski@gmail.com',
'Alexsander Akers' => 'a2@pandamonia.us' }
- s.source = { :git => 'https://github.com/zwaldowski/BlocksKit.git', :tag => 'v0.9.5' }
- s.source_files = 'BlocksKit'
+ s.source = { :git => 'https://github.com/zwaldowski/BlocksKit.git', :tag => 'v1.0.0' }
+ s.source_files = 'BlocksKit/*.{h,m}'
s.dependency = 'A2DynamicDelegate'
s.frameworks = 'MessageUI'
s.requires_arc = false
- s.clean_paths = 'GHUnitIOS.framework/', 'Tests/'
+ s.clean_paths = 'GHUnitIOS.framework/', 'Tests/', 'BlocksKit.xcodeproj/', '.gitignore'
def s.post_install(target)
prefix_header = config.project_pods_root + target.prefix_header_filename
prefix_header.open('a') do |file|
| Make sure CocoaPods only includes code files.
Signed-off-by: Zachary Waldowski <f6cb034ae1bf314d2c0261a7a22e4684d1f74b57@gmail.com>
|
diff --git a/Casks/commandq.rb b/Casks/commandq.rb
index abc1234..def5678 100644
--- a/Casks/commandq.rb
+++ b/Casks/commandq.rb
@@ -6,7 +6,7 @@ name 'CommandQ'
appcast 'http://shine.clickontyler.com/appcast.php?id=16',
:sha256 => 'aded9f4d5543c963c0989f53ba18c35b2053703b543b10a54c61a6b42b53dd50'
- homepage 'http://clickontyler.com/commandq/'
+ homepage 'https://clickontyler.com/commandq/'
license :unknown # todo: change license and remove this comment; ':unknown' is a machine-generated placeholder
app 'CommandQ.app'
| Fix homepage to use SSL in CommandQ Cask
The HTTP URL is already getting redirected to HTTPS. Using the HTTPS URL directly
makes it more secure and saves a HTTP round-trip.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.