diff
stringlengths 65
26.7k
| message
stringlengths 7
9.92k
|
|---|---|
diff --git a/spec/default_search_spec.rb b/spec/default_search_spec.rb
index abc1234..def5678 100644
--- a/spec/default_search_spec.rb
+++ b/spec/default_search_spec.rb
@@ -20,7 +20,7 @@ end
it "Should match partial title and TOC text" do
- default_search('b3176352', 'Effects of globalization in india', 5)
+ default_search('b3176352', 'Effects of globalization in india', 10)
end
end
|
Make partial title and TOC match less strict.
|
diff --git a/spec/hosts/test_api_spec.rb b/spec/hosts/test_api_spec.rb
index abc1234..def5678 100644
--- a/spec/hosts/test_api_spec.rb
+++ b/spec/hosts/test_api_spec.rb
@@ -9,5 +9,10 @@ it 'subject should return a catalogue' do
expect(subject.call).to be_a(Puppet::Resource::Catalog)
end
+
+ it 'should have resources in its coverage report' do
+ expect(RSpec::Puppet::Coverage.instance.results[:total]).to be > 0
+ expect(RSpec::Puppet::Coverage.instance.results[:resources]).to include('Notify[test]')
+ end
end
end
|
Add to ensure that we generate coverage info for hosts
|
diff --git a/spec/lib/wiki_edits_spec.rb b/spec/lib/wiki_edits_spec.rb
index abc1234..def5678 100644
--- a/spec/lib/wiki_edits_spec.rb
+++ b/spec/lib/wiki_edits_spec.rb
@@ -7,7 +7,15 @@ end
describe '.tokens' do
- pending 'should fetch edit tokens for an OAuthed user'
+ it 'should get edit tokens using OAuth credentials' do
+ user = create(:user,
+ wiki_token: 'foo',
+ wiki_secret: 'bar')
+
+ fake_tokens = "{\"query\":{\"tokens\":{\"csrftoken\":\"myfaketoken+\\\\\"}}}"
+ stub_request(:get, /.*/).to_return(:status => 200, :body => fake_tokens, :headers => {})
+ response = WikiEdits.tokens(user)
+ end
end
describe '.api_get' do
|
Add the start of a stub-based spec of WikiEdits
|
diff --git a/spec/support/html_helper.rb b/spec/support/html_helper.rb
index abc1234..def5678 100644
--- a/spec/support/html_helper.rb
+++ b/spec/support/html_helper.rb
@@ -1,6 +1,6 @@ module OpenFoodNetwork
module HtmlHelper
- def save_and_open(html)
+ def html_save_and_open(html)
require "launchy"
file = Tempfile.new('html')
file.write html
|
Rename spec support method for faster tab completion on save_and_open_page
|
diff --git a/climate_control.gemspec b/climate_control.gemspec
index abc1234..def5678 100644
--- a/climate_control.gemspec
+++ b/climate_control.gemspec
@@ -5,8 +5,8 @@ Gem::Specification.new do |gem|
gem.name = "climate_control"
gem.version = ClimateControl::VERSION
- gem.authors = ["Joshua Clayton"]
- gem.email = ["joshua.clayton@gmail.com"]
+ gem.authors = ["Joshua Clayton", "Dorian Marié"]
+ gem.email = ["joshua.clayton@gmail.com", "dorian@dorianmarie.fr"]
gem.description = "Modify your ENV"
gem.summary = "Modify your ENV easily with ClimateControl"
gem.homepage = "https://github.com/thoughtbot/climate_control"
|
Add myself as gem author
|
diff --git a/spec/controllers/spree/admin/sale_prices_controller_spec.rb b/spec/controllers/spree/admin/sale_prices_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/spree/admin/sale_prices_controller_spec.rb
+++ b/spec/controllers/spree/admin/sale_prices_controller_spec.rb
@@ -0,0 +1,27 @@+require 'spec_helper'
+
+describe Spree::Admin::SalePricesController, type: :controller do
+ routes { Spree::Core::Engine.routes }
+ let(:sale_price) { mock_model(Spree::SalePrice) }
+ let(:product) { mock_model(Spree::Product) }
+
+ before do
+ allow(Spree::Product).to receive(:find_by).and_return(product)
+ end
+
+ describe 'destroy format: js' do
+ before do
+ allow(Spree::SalePrice).to receive(:find).and_return(sale_price)
+ end
+
+ it 'finds the sale price by param' do
+ expect(Spree::SalePrice).to receive(:find).with('1337').and_return(sale_price)
+ delete :destroy, id: 1337, product_id: 42, format: :js
+ end
+
+ it 'deletes the sale price' do
+ expect(sale_price).to receive(:destroy)
+ delete :destroy, id: 1337, product_id: 42, format: :js
+ end
+ end
+end
|
Introduce tests for the admin-controller: spec the destroy action.
|
diff --git a/mustache-js-rails.gemspec b/mustache-js-rails.gemspec
index abc1234..def5678 100644
--- a/mustache-js-rails.gemspec
+++ b/mustache-js-rails.gemspec
@@ -19,5 +19,5 @@ s.files = Dir["{vendor,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "Gemfile", "README.md"]
s.require_paths = ["lib"]
- s.add_dependency 'railties', '>= 3.1', '<= 5.1'
+ s.add_dependency 'railties', '>= 3.1', '< 6'
end
|
Allow any Rails 5.x version
|
diff --git a/spec/formatters/key_value_deep_spec.rb b/spec/formatters/key_value_deep_spec.rb
index abc1234..def5678 100644
--- a/spec/formatters/key_value_deep_spec.rb
+++ b/spec/formatters/key_value_deep_spec.rb
@@ -36,8 +36,7 @@ expect(subject).to include('params_object_key_array_1=2')
end
- it 'return the correct serialization' do
- puts subject
+ it 'returns the correct serialization' do
expect(subject).to eq("custom=data status=200 method=GET path=/ \
controller=welcome action=index params_object_key=value params_object_key_array_0=1 \
params_object_key_array_1=2 params_object_key_array_2=3.40")
|
Remove extraneous `puts` from spec
This was probably mistakenly forgotten in #282.
Also fixes a typo in the spec description.
|
diff --git a/app/controllers/api/v1/expense_reports_controller.rb b/app/controllers/api/v1/expense_reports_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/api/v1/expense_reports_controller.rb
+++ b/app/controllers/api/v1/expense_reports_controller.rb
@@ -21,6 +21,14 @@ end
def update
+ expense_report = ExpenseReport.find(params[:id])
+ expense_report.expenses.destroy_all
+ expense_report.update_attributes(safe_params)
+ if expense_report.save
+ render :json => expense_report
+ else
+ render :json => expense_report.errors, :status => :unprocessable_entity
+ end
end
private
|
Implement expense report update action
|
diff --git a/spec/integration/integration_helper.rb b/spec/integration/integration_helper.rb
index abc1234..def5678 100644
--- a/spec/integration/integration_helper.rb
+++ b/spec/integration/integration_helper.rb
@@ -21,11 +21,10 @@ end
def use_cucumber_config(file)
- if File.file?("#{@project_path}/config/#{file}")
- system("mv #{@project_path}/config/#{file} #{@project_path}/config/cucumber.yml")
- else
- raise "#{file} doesn't exist. Please use existing configuration yaml."
- end
+ file_exists = File.file?("#{@project_path}/config/#{file}")
+ raise "#{file} doesn't exist. Please use existing configuration yaml." unless file_exists
+
+ system("mv #{@project_path}/config/#{file} #{@project_path}/config/cucumber.yml")
end
# :reek:TooManyStatements
|
Fix style according to Mr. Rubocop
|
diff --git a/app/controllers/subscribem/application_controller.rb b/app/controllers/subscribem/application_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/subscribem/application_controller.rb
+++ b/app/controllers/subscribem/application_controller.rb
@@ -13,7 +13,7 @@ def current_user
if user_signed_in?
@current_user ||= begin
- user_id = env['warden'].user(scope: :account)
+ user_id = env['warden'].user(scope: :user)
Subscribem::User.find(user_id)
end
end
|
Fix warden error fetching current_user
|
diff --git a/app/jobs/enqueue_publishers_for_paypal_payout_job.rb b/app/jobs/enqueue_publishers_for_paypal_payout_job.rb
index abc1234..def5678 100644
--- a/app/jobs/enqueue_publishers_for_paypal_payout_job.rb
+++ b/app/jobs/enqueue_publishers_for_paypal_payout_job.rb
@@ -3,7 +3,7 @@
def perform(should_send_notifications: false, final: true, manual: false, payout_report_id:)
payout_report = PayoutReport.find(payout_report_id)
- publishers = Publisher.joins(:paypal_connection).with_verified_channel.where(paypal_connections: {country: "Japan" })
+ publishers = Publisher.joins(:paypal_connection).with_verified_channel.where(paypal_connections: {country: "JP" })
publishers.find_each do |publisher|
IncludePublisherInPayoutReportJob.perform_async(
payout_report_id: payout_report.id,
|
Use the right country designation for country
|
diff --git a/db/migrate/20130911191210_add_data_dump_delayed_jobs.rb b/db/migrate/20130911191210_add_data_dump_delayed_jobs.rb
index abc1234..def5678 100644
--- a/db/migrate/20130911191210_add_data_dump_delayed_jobs.rb
+++ b/db/migrate/20130911191210_add_data_dump_delayed_jobs.rb
@@ -0,0 +1,14 @@+class AddDataDumpDelayedJobs < ActiveRecord::Migration
+ def up
+ Delayed::Job.enqueue StatsDump, { :priority => 5, :run_at => DateTime.now.tomorrow.change(:hour => 1, :min => 30) }
+ Delayed::Job.enqueue CertificateDump, { :priority => 5, :run_at => DateTime.now.tomorrow.change(:hour => 2, :min => 0) }
+ end
+
+ def down
+ stats = Delayed::Job.enqueue StatsDump, { :priority => 5, :run_at => DateTime.now.tomorrow.change(:hour => 1, :min => 30) }
+ stats.delete
+
+ cert = Delayed::Job.enqueue CertificateDump, { :priority => 5, :run_at => DateTime.now.tomorrow.change(:hour => 2, :min => 0) }
+ cert.delete
+ end
+end
|
Add migration to set up delayed job
|
diff --git a/db/migrate/20140401181046_remove_simple_captcha_data.rb b/db/migrate/20140401181046_remove_simple_captcha_data.rb
index abc1234..def5678 100644
--- a/db/migrate/20140401181046_remove_simple_captcha_data.rb
+++ b/db/migrate/20140401181046_remove_simple_captcha_data.rb
@@ -0,0 +1,15 @@+class RemoveSimpleCaptchaData < ActiveRecord::Migration
+ def up
+ drop_table :simple_captcha_data
+ end
+
+ def down
+ create_table :simple_captcha_data do |t|
+ t.string :key, :limit => 40
+ t.string :value, :limit => 6
+ t.timestamps
+ end
+
+ add_index :simple_captcha_data, :key, :name => "idx_key"
+ end
+end
|
Add migration to remove simple_captcha_data table
|
diff --git a/db/migrate/20170227125753_change_column_type_to_text.rb b/db/migrate/20170227125753_change_column_type_to_text.rb
index abc1234..def5678 100644
--- a/db/migrate/20170227125753_change_column_type_to_text.rb
+++ b/db/migrate/20170227125753_change_column_type_to_text.rb
@@ -0,0 +1,47 @@+class ChangeColumnTypeToText < ActiveRecord::Migration
+ def change
+ return unless Redmine::Database.postgresql?
+ opclass = "pgroonga.varchar_full_text_search_ops"
+ reversible do |d|
+ d.up do
+ remove_index(:projects, [:id, :name, :identifier, :description])
+ remove_index(:news, [:id, :title, :summary, :description])
+ remove_index(:issues, [:id, :subject, :description])
+ remove_index(:documents, [:id, :title, :description])
+ remove_index(:messages, [:id, :subject, :content])
+ remove_index(:wiki_pages, [:id, :title])
+ remove_index(:attachments, [:id, :filename, :description])
+
+ [
+ [:projects, "id, name #{opclass}, identifier #{opclass}, description"],
+ [:news, "id, title #{opclass}, summary #{opclass}, description"],
+ [:issues, "id, subject #{opclass}, description"],
+ [:documents, "id, title #{opclass}, description"],
+ [:messages, "id, subject #{opclass}, content"],
+ [:wiki_pages, "id, title #{opclass}"],
+ [:attachments, "id, filename #{opclass}, description"],
+ ].each do |table, columns|
+ sql = "CREATE INDEX index_#{table}_pgroonga ON #{table} USING pgroonga (#{columns})"
+ execute(sql)
+ end
+ end
+ d.down do
+ remove_index(:projects, name: "index_projects_pgroonga")
+ remove_index(:news, name: "index_news_pgroonga")
+ remove_index(:issues, name: "index_issues_pgroonga")
+ remove_index(:documents, name: "index_documents_pgroonga")
+ remove_index(:messages, name: "index_messages_pgroonga")
+ remove_index(:wiki_pages, name: "index_wiki_pages_pgroonga")
+ remove_index(:attachments, name: "index_attachments_pgroonga")
+
+ add_index(:projects, [:id, :name, :identifier, :description], using: "pgroonga")
+ add_index(:news, [:id, :title, :summary, :description], using: "pgroonga")
+ add_index(:issues, [:id, :subject, :description], using: "pgroonga")
+ add_index(:documents, [:id, :title, :description], using: "pgroonga")
+ add_index(:messages, [:id, :subject, :content], using: "pgroonga")
+ add_index(:wiki_pages, [:id, :title], using: "pgroonga")
+ add_index(:attachments, [:id, :filename, :description], using: "pgroonga")
+ end
+ end
+ end
+end
|
Create index against column type varchar for PostgreSQL
|
diff --git a/db/migrate/20191115150137_remove_heat_network_mekkos.rb b/db/migrate/20191115150137_remove_heat_network_mekkos.rb
index abc1234..def5678 100644
--- a/db/migrate/20191115150137_remove_heat_network_mekkos.rb
+++ b/db/migrate/20191115150137_remove_heat_network_mekkos.rb
@@ -0,0 +1,11 @@+class RemoveHeatNetworkMekkos < ActiveRecord::Migration[5.2]
+ def up
+ OutputElement.find_by_key(:mekko_agricultural_heat_network).destroy!
+ OutputElement.find_by_key(:mekko_overview_of_all_heat_networks).destroy!
+ OutputElement.find_by_key(:mekko_of_heat_network).destroy!
+ end
+
+ def down
+ raise ActiveRecord::IrreversibleMigration
+ end
+end
|
Add migration for removing old heat network mekkos
|
diff --git a/app/services/metrics/content_distribution_metrics.rb b/app/services/metrics/content_distribution_metrics.rb
index abc1234..def5678 100644
--- a/app/services/metrics/content_distribution_metrics.rb
+++ b/app/services/metrics/content_distribution_metrics.rb
@@ -2,7 +2,7 @@ class ContentDistributionMetrics
def count_content_per_level
counts_by_level.each_with_index do |count, level|
- Services.statsd.gauge("content_tagged.level_#{level + 1}", count)
+ Metrics.statsd.gauge("content_tagged.level_#{level + 1}", count)
end
end
@@ -11,7 +11,7 @@ avg_depth = counts_by_level.to_enum.with_index(1).reduce(0.0) do |result, (count, level)|
result + (count.to_f / sum) * level
end
- Services.statsd.gauge("average_tagging_depth", avg_depth)
+ Metrics.statsd.gauge("average_tagging_depth", avg_depth)
end
private
|
Use the taxonomy metrics namespace for distribution metrics
|
diff --git a/cookbooks/zookeeper_cluster/metadata.rb b/cookbooks/zookeeper_cluster/metadata.rb
index abc1234..def5678 100644
--- a/cookbooks/zookeeper_cluster/metadata.rb
+++ b/cookbooks/zookeeper_cluster/metadata.rb
@@ -8,8 +8,6 @@
depends "java"
depends "apt"
-depends "mountable_volumes"
-depends "provides_service"
recipe "zookeeper::client", "Installs Zookeeper client libraries"
recipe "zookeeper::default", "Base configuration for zookeeper"
|
Remove 2 dependencies on provides_service and mountable_volumes from zookeeper. These just don't exist anywhere and they break bulk cookbook uploads
|
diff --git a/spec/features/users_spec.rb b/spec/features/users_spec.rb
index abc1234..def5678 100644
--- a/spec/features/users_spec.rb
+++ b/spec/features/users_spec.rb
@@ -9,7 +9,7 @@ fill_in 'user_email', with: attributes_for(:user)[:email]
fill_in 'user_password', with: attributes_for(:user)[:password]
- click_button 'create_user'
+ click_button 'Signup'
}.to change(User, :count).by(1)
end
|
Change name of click button feature test
|
diff --git a/spec/message_filter_spec.rb b/spec/message_filter_spec.rb
index abc1234..def5678 100644
--- a/spec/message_filter_spec.rb
+++ b/spec/message_filter_spec.rb
@@ -11,6 +11,9 @@ context 'with argument "foo"' do
subject { MessageFilter.new('foo') }
it_behaves_like 'MessageFilter with argument "foo"'
+ it 'ng_words size is 1' do
+ expect(subject.ng_words.size).to eq 1
+ end
end
context 'with argument "foo","bar"' do
|
Add example for ng_words size
|
diff --git a/test/helper.rb b/test/helper.rb
index abc1234..def5678 100644
--- a/test/helper.rb
+++ b/test/helper.rb
@@ -3,19 +3,58 @@ require 'minitest/autorun'
require 'mocha/mini_test'
-def command_instance(klass, config={}, args=[])
- Miasma.test_api = connection
- instance = klass.new(config.merge(:ui => ui, :credentials => {:provider => :aws}), args)
- instance
+# Stub out HTTP so we can easily intercept remote calls
+require 'http'
+
+class HTTP::Client
+
+ HTTP::Request::METHODS.each do |h_method|
+ define_method(h_method) do |*args|
+ $mock.send(h_method, *args)
+ end
+ end
+
end
-module Miasma
- class << self
- attr_accessor :test_api
- def api(*_)
- test_api
- end
+module SfnHttpMock
+ def setup
+ $mock = Mocha::Mock.new(Mocha::Mockery.instance)
+ end
+
+ def teardown
+ $mock = nil
+ @ui = nil
+ @stream = nil
+ end
+
+ def stream
+ @stream ||= StringIO.new('')
+ end
+
+ def ui
+ @ui ||= Bogo::Ui.new(
+ :app_name => 'TestUi',
+ :output_to => stream,
+ :colors => false
+ )
+ end
+
+ def aws_creds
+ Smash.new(
+ :provider => :aws,
+ :aws_access_key_id => 'AWS_ACCESS_KEY_ID',
+ :aws_secret_access_key => 'AWS_SECRET_ACCESS_KEY',
+ :aws_region => 'AWS_REGION'
+ )
+ end
+
+ def http_response(opts)
+ opts[:version] ||= '1.1'
+ opts[:status] ||= 200
+ HTTP::Response.new(opts)
end
end
-require 'miasma/contrib/aws'
+class MiniTest::Test
+ include SfnHttpMock
+end
|
Update mocking strategy for remote intecepts
|
diff --git a/test/helper.rb b/test/helper.rb
index abc1234..def5678 100644
--- a/test/helper.rb
+++ b/test/helper.rb
@@ -20,12 +20,17 @@ Coveralls::SimpleCov::Formatter
]
+ add_group "Grammars" do |source_file|
+ source_file.filename =~ %r{\.y$}
+ end
+
+ # Exclude the testsuite itself.
add_filter "/test/"
- add_filter "/lib/parser/lexer.rb"
- add_filter "/lib/parser/ruby18.rb"
- add_filter "/lib/parser/ruby19.rb"
- add_filter "/lib/parser/ruby20.rb"
+ # Exclude generated files.
+ add_filter do |source_file|
+ source_file.filename =~ %r{/lib/parser/(lexer|ruby\d+)\.rb$}
+ end
end
end
|
Add a separate coverage category for .y files.
|
diff --git a/test/helper.rb b/test/helper.rb
index abc1234..def5678 100644
--- a/test/helper.rb
+++ b/test/helper.rb
@@ -10,6 +10,7 @@ require 'rr'
unless defined?(Test::Unit::AssertionFailedError)
+ require 'activesupport'
class Test::Unit::AssertionFailedError < ActiveSupport::TestCase::Assertion
end
end
|
Bring in the big guns.
|
diff --git a/lib/browser.rb b/lib/browser.rb
index abc1234..def5678 100644
--- a/lib/browser.rb
+++ b/lib/browser.rb
@@ -1,5 +1,5 @@ module Browser
- ALLOWED_BROWSERS = %w[firefox ie11 ie10 ie9 ie8 ie7 chrome safari]
+ ALLOWED_BROWSERS = %w[firefox ie11 ie10 ie9 chrome safari]
def user_agent
case request.env['HTTP_USER_AGENT']
@@ -10,9 +10,6 @@ when /Trident\/7/ then 'ie11'
when /MSIE 10/ then 'ie10'
when /MSIE 9/ then 'ie9'
- when /MSIE 8/ then 'ie8'
- when /MSIE 7/ then 'ie7'
- when /MSIE 6/ then 'ie6'
end
end
|
Remove support for IE7 and IE8
Ref #1978
|
diff --git a/lib/chamber.rb b/lib/chamber.rb
index abc1234..def5678 100644
--- a/lib/chamber.rb
+++ b/lib/chamber.rb
@@ -38,7 +38,10 @@ end
def load_file(file_path)
- settings.merge! YAML.load(File.read(file_path.to_s))
+ file_contents = File.read(file_path.to_s)
+ yaml_contents = YAML.load(file_contents)
+
+ settings.merge! yaml_contents
end
def settings
|
Decompress a few lines for better readability
|
diff --git a/test/unit/services/link_checker_api_service_test.rb b/test/unit/services/link_checker_api_service_test.rb
index abc1234..def5678 100644
--- a/test/unit/services/link_checker_api_service_test.rb
+++ b/test/unit/services/link_checker_api_service_test.rb
@@ -0,0 +1,38 @@+require 'test_helper'
+
+class LinkCheckerApiServiceTest < ActiveSupport::TestCase
+ WEBHOOK_URI = "https://example.com/webhook_uri".freeze
+ LINK_CHECKER_RESPONSE = { id: 123, completed_at: nil, status: "completed" }.to_json.freeze
+
+ test "checks external URL" do
+ edition = Edition.new(body: "A doc with a link to [an external URL](https://example.com/some-page)")
+
+ link_check_request = stub_request(:post, "https://link-checker-api.test.gov.uk/batch").
+ with(body: /https:\/\/example\.com\/webhook_uri/).
+ to_return(status: 200, body: LINK_CHECKER_RESPONSE)
+
+ LinkCheckerApiService.check_links(edition, WEBHOOK_URI)
+
+ assert_requested(link_check_request)
+ end
+
+ test "checks internal URL" do
+ edition = Edition.new(body: "A doc with a link to [an internal URL](/bank-holidays)")
+
+ link_check_request = stub_request(:post, "https://link-checker-api.test.gov.uk/batch").
+ with(body: /\/bank-holidays/).
+ to_return(status: 200, body: LINK_CHECKER_RESPONSE)
+
+ LinkCheckerApiService.check_links(edition, WEBHOOK_URI)
+
+ assert_requested(link_check_request)
+ end
+
+ test "raises error if there are no URLs in the document" do
+ edition = Edition.new(body: "Some text")
+
+ assert_raises "Reportable has no links to check" do
+ LinkCheckerApiService.check_links(edition, WEBHOOK_URI)
+ end
+ end
+end
|
Add unit tests for link checker service
In preparation for adding public URL lookups to the service.
|
diff --git a/test/tests/test_json_compare.rb b/test/tests/test_json_compare.rb
index abc1234..def5678 100644
--- a/test/tests/test_json_compare.rb
+++ b/test/tests/test_json_compare.rb
@@ -7,6 +7,10 @@ File.delete @json_path if File.exist? @json_path
Brakeman.run :app_path => @path, :output_files => [@json_path]
@report = MultiJson.load File.read(@json_path)
+ end
+
+ def teardown
+ File.delete @json_path if File.exist? @json_path
end
def update_json
|
Clean up JSON file from tests
|
diff --git a/test/unit/resque_worker_test.rb b/test/unit/resque_worker_test.rb
index abc1234..def5678 100644
--- a/test/unit/resque_worker_test.rb
+++ b/test/unit/resque_worker_test.rb
@@ -25,14 +25,10 @@ resque_job_file = File.expand_path('./test_resque_job.rb', File.dirname(__FILE__))
require resque_job_file
- #report after loading the file in parent process
- Coverband::Collectors::Coverage.instance.report_coverage(true)
-
enqueue_and_run_job
assert !Coverband::Background.running?
- puts "assert_equal 1, Coverband.configuration.store.coverage['#{resque_job_file}']['data'][4]"
assert_equal 1, Coverband.configuration.store.coverage[resque_job_file]['data'][4]
end
end
|
Remove extra report call in resque test
|
diff --git a/spec/features/projects/labels/update_prioritization_spec.rb b/spec/features/projects/labels/update_prioritization_spec.rb
index abc1234..def5678 100644
--- a/spec/features/projects/labels/update_prioritization_spec.rb
+++ b/spec/features/projects/labels/update_prioritization_spec.rb
@@ -0,0 +1,78 @@+require 'spec_helper'
+
+feature 'Prioritize labels', feature: true do
+ include WaitForAjax
+
+ let(:user) { create(:user) }
+ let(:project) { create(:project, name: 'test', namespace: user.namespace) }
+
+ scenario 'user can prioritize a label', js: true do
+ bug = create(:label, title: 'bug')
+ wontfix = create(:label, title: 'wontfix')
+
+ project.labels << bug
+ project.labels << wontfix
+
+ login_as user
+ visit namespace_project_labels_path(project.namespace, project)
+
+ expect(page).to have_content('No prioritized labels yet')
+
+ page.within('.other-labels') do
+ first('.js-toggle-priority').click
+ wait_for_ajax
+ expect(page).not_to have_content('bug')
+ end
+
+ page.within('.prioritized-labels') do
+ expect(page).not_to have_content('No prioritized labels yet')
+ expect(page).to have_content('bug')
+ end
+ end
+
+ scenario 'user can unprioritize a label', js: true do
+ bug = create(:label, title: 'bug', priority: 1)
+ wontfix = create(:label, title: 'wontfix')
+
+ project.labels << bug
+ project.labels << wontfix
+
+ login_as user
+ visit namespace_project_labels_path(project.namespace, project)
+
+ expect(page).to have_content('bug')
+
+ page.within('.prioritized-labels') do
+ first('.js-toggle-priority').click
+ wait_for_ajax
+ expect(page).not_to have_content('bug')
+ end
+
+ page.within('.other-labels') do
+ expect(page).to have_content('bug')
+ expect(page).to have_content('wontfix')
+ end
+ end
+
+ scenario 'user can sort prioritized labels', js: true do
+ bug = create(:label, title: 'bug', priority: 1)
+ wontfix = create(:label, title: 'wontfix', priority: 2)
+
+ project.labels << bug
+ project.labels << wontfix
+
+ login_as user
+ visit namespace_project_labels_path(project.namespace, project)
+
+ expect(page).to have_content 'bug'
+ expect(page).to have_content 'wontfix'
+
+ # Sort labels
+ find("#label_#{bug.id}").drag_to find("#label_#{wontfix.id}")
+
+ page.within('.prioritized-labels') do
+ expect(first('li')).to have_content('wontfix')
+ expect(page.all('li').last).to have_content('bug')
+ end
+ end
+end
|
Add tests for label prioritization
|
diff --git a/test/iruby/jupyter_test.rb b/test/iruby/jupyter_test.rb
index abc1234..def5678 100644
--- a/test/iruby/jupyter_test.rb
+++ b/test/iruby/jupyter_test.rb
@@ -3,24 +3,24 @@ module IRubyTest
class JupyterDefaultKernelSpecDirectoryTest < TestBase
def setup
- @kernel_spec = IRuby::Jupyter.kernelspec_dir
+ @kernelspec_dir = IRuby::Jupyter.kernelspec_dir
end
def test_default_windows
windows_only
appdata = IRuby::Jupyter.send :windows_user_appdata
- assert_equal(File.join(appdata, 'jupyter/kernels'), @kernel_spec)
+ assert_equal(File.join(appdata, 'jupyter/kernels'), @kernelspec_dir)
end
def test_default_apple
apple_only
- assert_equal(File.expand_path('~/Library/Jupyter/kernels'), @kernel_spec)
+ assert_equal(File.expand_path('~/Library/Jupyter/kernels'), @kernelspec_dir)
end
def test_default_unix
unix_only
with_env('XDG_DATA_HOME' => nil) do
- assert_equal(File.expand_path('~/.local/share/jupyter/kernels'), @kernel_spec)
+ assert_equal(File.expand_path('~/.local/share/jupyter/kernels'), @kernelspec_dir)
end
end
end
|
Rename instance variable in a test
|
diff --git a/test_code/json_php_test_code.rb b/test_code/json_php_test_code.rb
index abc1234..def5678 100644
--- a/test_code/json_php_test_code.rb
+++ b/test_code/json_php_test_code.rb
@@ -0,0 +1,52 @@+require 'json'
+require 'faraday'
+
+url = "http://cal.syoboi.jp"
+json_path = "/json.php"
+
+program_title = "冴えない彼女の育てかた"
+
+begin
+ connection ||= Faraday::Connection.new(url: url) do |c|
+ c.request :url_encoded
+ c.response :logger
+ c.adapter :net_http
+ c.response :raise_error
+ end
+rescue => e
+ puts "Connection error #{e}"
+end
+
+params = {
+ Req: "TitleSearch",
+ Search: "#{program_title}",
+ Limit: 15
+}
+
+response = connection.get(json_path, params)
+body = JSON.parse(response.body)
+puts body["Titles"].keys[0]
+
+=begin
+ responce.bodyの中身は
+ {Titles : {"3141" : {
+ "TID" : "3141",
+ "Title" : "ストライク・ザ・ブラッド",
+ "ShortTitle" : "",
+ "TitleYomi" : "ストライク・ザ・ブラッド",
+ "TitleEN" : "STRIKE THE BLOOD",
+ "Cat" : "10",
+ "FirstCh" : "AT-X",
+ "FirstYear" : "2013",
+ "FirstMonth" : "10",
+ "FirstEndYear" : "2014",
+ "FirstEndMonth" : "3",
+ "TitleFlag" : "0",
+ "Comment" : "",
+ "Search" : ""
+ }
+ }
+ }
+ みたいな感じになってる。
+ Titlesの下でTIDが重複しているけどあまり問題無さそう
+=end
|
Add test program of json.php
|
diff --git a/test/test_faker_bitcoin.rb b/test/test_faker_bitcoin.rb
index abc1234..def5678 100644
--- a/test/test_faker_bitcoin.rb
+++ b/test/test_faker_bitcoin.rb
@@ -7,8 +7,8 @@ end
def test_testnet_address
- assert_match /\A[mn][1-9A-Za-z]{32,34}\Z/, Faker::Bitcoin.testnet_address
- assert_not_match /[OIl]/, Faker::Bitcoin.testnet_address
+ assert_match(/\A[mn][1-9A-Za-z]{32,34}\Z/, Faker::Bitcoin.testnet_address)
+ assert_not_match(/[OIl]/, Faker::Bitcoin.testnet_address)
end
end
|
Remove `warning: ambiguous first argument; put parentheses or a space even after `/' operator`
|
diff --git a/lib/context.rb b/lib/context.rb
index abc1234..def5678 100644
--- a/lib/context.rb
+++ b/lib/context.rb
@@ -1,32 +1,43 @@ require 'application_insights'
-module AIAgent
+module ApplicationInsightsInstaller
class Context
class << self
- def self.configure(config)
- @context = ApplicationInsights::Channel::TelemetryContext.new
+ def configure(config = {})
+ @context = telemetry_client.context
- @context.user = extract_configs config, 'ai.user.'
- @context.device = extract_configs config, 'ai.device.'
- @context.session = extract_configs config, 'ai.session.'
- @context.location = extract_configs config, 'ai.location.'
- @context.operation = extract_configs config, 'ai.operation.'
- @context.application = extract_configs config, 'ai.application.'
- @context.instrumentation_key = config.delete :instrumentation_key
- @context.properties = config
+ contracts.each do |contract|
+ instance = configure_contract(contract.capitalize, config)
+ @context.send :"#{contract}=", instance
+ end
+
+ @context.instrumentation_key = config['instrumentation_key']
+ @context.properties = extract_custom_properties config
+
+ @context
end
- def self.telemetry_client
- @client ||=
- ApplicationInsights::TelemetryClient.new.tap do |tc|
- tc.context = @context if @context
- end
+ def telemetry_client
+ @client ||= ApplicationInsights::TelemetryClient.new
end
private
- def extract_configs(config, key_prefix)
- config.delete_if { |k,v| k.to_s.start_with? key_prefix }
+ def configure_contract(contract, config)
+ const = ApplicationInsights::Channel::Contracts.const_get contract.to_sym
+
+ const.new config[contract.downcase]
+ rescue NameError => e
+ nil
+ end
+
+ # Custom properties are defined at [ai] level of the config file.
+ def extract_custom_properties(config)
+ config.reject { |k, v| k.to_s == 'instrumentation_key' || v.is_a?(Hash) }
+ end
+
+ def contracts
+ %w(user device session location operation application)
end
end
end
|
Update Context class to read the settings from a toml file
|
diff --git a/loquor.gemspec b/loquor.gemspec
index abc1234..def5678 100644
--- a/loquor.gemspec
+++ b/loquor.gemspec
@@ -18,7 +18,7 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
- spec.add_dependency 'filum', '0.0.1'
+ spec.add_dependency 'filum', '0.0.2'
spec.add_dependency 'rest-client', '1.6.7'
spec.add_dependency "api-auth", "1.0.3"
|
Upgrade filum to fix tests.
|
diff --git a/db/migrate/20161128102235_change_art_museum_to_museum_art.rb b/db/migrate/20161128102235_change_art_museum_to_museum_art.rb
index abc1234..def5678 100644
--- a/db/migrate/20161128102235_change_art_museum_to_museum_art.rb
+++ b/db/migrate/20161128102235_change_art_museum_to_museum_art.rb
@@ -0,0 +1,27 @@+class ChangeArtMuseumToMuseumArt < ActiveRecord::Migration
+ class LocalNodeType < ActiveRecord::Base
+ self.table_name = 'node_types'
+ validates :icon, presence: true
+ end
+
+ # Rename art_museum.png to museum_art.png but keep same identifier & osm_value
+ def up
+ node_type = LocalNodeType.find_by(id: 153)
+ if node_type.nil?
+ return
+ else
+ node_type.icon = 'museum_art.png'
+ node_type.save
+ end
+ end
+
+ def down
+ node_type = LocalNodeType.find_by(id: 153)
+ if node_type.nil?
+ return
+ else
+ node_type.icon = 'art_museum.png'
+ node_type.save
+ end
+ end
+end
|
Rename and migrate art_museum.png to museum_art.png in node_types table
Fixes 404 - icon not found error for "Art Museum"
Related Github issue: #484
|
diff --git a/db/migrate/20161128102235_change_art_museum_to_museum_art.rb b/db/migrate/20161128102235_change_art_museum_to_museum_art.rb
index abc1234..def5678 100644
--- a/db/migrate/20161128102235_change_art_museum_to_museum_art.rb
+++ b/db/migrate/20161128102235_change_art_museum_to_museum_art.rb
@@ -6,7 +6,7 @@
# Rename art_museum.png to museum_art.png but keep same identifier & osm_value
def up
- node_type = NodeType.find_by(identifier: 'art', osm_value: 'art', icon: 'art_museum.png')
+ node_type = LocalNodeType.find_by(identifier: 'art', osm_value: 'art', icon: 'art_museum.png')
unless node_type.nil? && node_type.icon == 'art_museum.png'
node_type.icon = 'museum_art.png'
node_type.save
@@ -16,7 +16,7 @@ end
def down
- node_type = NodeType.find_by(identifier: 'art', osm_value: 'art', icon: 'museum_art.png')
+ node_type = LocalNodeType.find_by(identifier: 'art', osm_value: 'art', icon: 'museum_art.png')
unless node_type.nil? && node_type.icon == 'museum_art.png'
node_type.icon = 'art_museum.png'
node_type.save
|
Rename NodeType class back to LocalNodeType to use own model for migration
|
diff --git a/core/kernel/printf_spec.rb b/core/kernel/printf_spec.rb
index abc1234..def5678 100644
--- a/core/kernel/printf_spec.rb
+++ b/core/kernel/printf_spec.rb
@@ -8,5 +8,27 @@ end
describe "Kernel.printf" do
- it "needs to be reviewed for spec completeness"
+
+ before :each do
+ @stdout = $stdout
+ @name = tmp("kernel_puts.txt")
+ $stdout = new_io @name
+ end
+
+ after :each do
+ $stdout.close
+ $stdout = @stdout
+ rm_r @name
+ end
+
+ it "writes to stdout when a string is the first argument" do
+ $stdout.should_receive(:write).with("string")
+ Kernel.printf("%s", "string")
+ end
+
+ it "calls write on the first argument when it is not a string" do
+ object = mock('io')
+ object.should_receive(:write).with("string")
+ Kernel.printf(object, "%s", "string")
+ end
end
|
Add basic specs for Kernel.printf
|
diff --git a/backend/spec/controllers/api/v1/sessions_controller_spec.rb b/backend/spec/controllers/api/v1/sessions_controller_spec.rb
index abc1234..def5678 100644
--- a/backend/spec/controllers/api/v1/sessions_controller_spec.rb
+++ b/backend/spec/controllers/api/v1/sessions_controller_spec.rb
@@ -28,25 +28,4 @@ end
end
- describe 'DELETE "/sessions"' do
- it 'should logout users with valid credentials' do
- request.env['HTTP_AUTHORIZATION'] = %Q{Token token="#{@user.authentication_token}"}
- delete :destroy
- parsed_response = JSON.parse(response.body)
-
- response.should be_success
- parsed_response.should be_empty
- end
-
- it 'should fail with invalid credentials' do
- request.env['HTTP_AUTHORIZATION'] = %Q{Token token="invalid-token"}
- delete :destroy
- parsed_response = JSON.parse(response.body)
-
- response.status.should eq(401)
- assert parsed_response.has_key?('errors')
- parsed_response['errors'].should eq('Unauthorized.')
- end
- end
-
end
|
Drop test cases for session destroy.
|
diff --git a/actionsystemtest/lib/action_system_test/driver_adapters/web_server.rb b/actionsystemtest/lib/action_system_test/driver_adapters/web_server.rb
index abc1234..def5678 100644
--- a/actionsystemtest/lib/action_system_test/driver_adapters/web_server.rb
+++ b/actionsystemtest/lib/action_system_test/driver_adapters/web_server.rb
@@ -26,7 +26,7 @@ end
def register_puma(app, port)
- Rack::Handler::Puma.run(app, Port: port, Threads: "0:4")
+ Rack::Handler::Puma.run(app, Port: port, Threads: "0:1")
end
def register_webrick(app, port)
|
Use 1 thread instead of 4 with Puma server for system tests
|
diff --git a/app/controllers/admin/alert_types/find_out_more_preview_controller.rb b/app/controllers/admin/alert_types/find_out_more_preview_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/admin/alert_types/find_out_more_preview_controller.rb
+++ b/app/controllers/admin/alert_types/find_out_more_preview_controller.rb
@@ -17,7 +17,7 @@
def load_find_out_more_requirements
# TODO: match activity types ordering
- @activity_types = @alert_type.activity_types.limit(3)
+ @activity_types = @alert_type.ordered_activity_types.limit(3)
@school = @alert.school
content_version = FindOutMoreTypeContentVersion.new(content_params.fetch(:content))
@content = TemplateInterpolation.new(content_version).interpolate(:page_title, :page_content, with: @alert.template_variables)
|
Use same ordering in FOM preview as dashboard
|
diff --git a/lib/ohai/plugins/erlang.rb b/lib/ohai/plugins/erlang.rb
index abc1234..def5678 100644
--- a/lib/ohai/plugins/erlang.rb
+++ b/lib/ohai/plugins/erlang.rb
@@ -23,10 +23,10 @@ output = nil
erlang = Mash.new
-status, stdout, error = run_command(:no_status_check => true, :command => "erl +V")
+status, stdout, stderr = run_command(:no_status_check => true, :command => "erl +V")
if status == 0
- output = stderr.to_s.split
+ output = stderr.split
if output.length >= 6
options = output[1]
options.gsub!(/(\(|\))/, '')
|
Fix typo in Erlang plugin
|
diff --git a/lib/redmine/redmine-api.rb b/lib/redmine/redmine-api.rb
index abc1234..def5678 100644
--- a/lib/redmine/redmine-api.rb
+++ b/lib/redmine/redmine-api.rb
@@ -31,6 +31,19 @@ end
class Issue < Base
+ def self.find(*arguments)
+ scope = arguments.slice!(0)
+ options = arguments.slice!(0) || {}
+ # By including journals, we can get Notes aka Comments
+ # RedmineAPI::Issue.find(2180, :params => {:include => 'journals'})
+ get_comments = {:include => 'journals'}
+ if options[:params].nil?
+ options[:params] = get_comments
+ else
+ options[:params].merge!(get_comments)
+ end
+ super scope, options
+ end
end
class Project < Base
|
Refactor RedmineAPI::Issue.find to include journals which allows access to notes/comments
|
diff --git a/lib/stacks/proxy_server.rb b/lib/stacks/proxy_server.rb
index abc1234..def5678 100644
--- a/lib/stacks/proxy_server.rb
+++ b/lib/stacks/proxy_server.rb
@@ -6,9 +6,6 @@ def initialize(virtual_service, index)
super(virtual_service.name + "-" + index)
@virtual_service = virtual_service
- @downstream_services = []
- @proxy_vhosts_lookup = {}
- @proxy_vhosts = []
end
def bind_to(environment)
|
Remove code which doesn't appear to be needed that was throwing me off
|
diff --git a/lib/tasks/data_points.rake b/lib/tasks/data_points.rake
index abc1234..def5678 100644
--- a/lib/tasks/data_points.rake
+++ b/lib/tasks/data_points.rake
@@ -5,6 +5,7 @@ desc "Load data points and related records."
task load: :environment do
SpreadsheetConverter.new('db/fixtures/data_points.csv').perform!
+ puts "Loaded #{DataPoint.count} data points!"
end
end
@@ -32,6 +33,8 @@
def good_keys?(table)
conn = GeographicDatabase.connection
+ geoid = conn.column_exists?(table, 'geoid')
+ return "NO COLUMN 'GEOID'" unless geoid
keys = conn.execute "SELECT COUNT(*) FROM #{table} WHERE substring(geoid from '^.{7}') = '14000US';"
count = conn.execute "SELECT COUNT(*) FROM #{table};"
keys == conn ? "WITH GOOD IDS" : "BUT BAD IDS"
|
Check if column even exists
|
diff --git a/core/app/controllers/spree/admin/tax_settings_controller.rb b/core/app/controllers/spree/admin/tax_settings_controller.rb
index abc1234..def5678 100644
--- a/core/app/controllers/spree/admin/tax_settings_controller.rb
+++ b/core/app/controllers/spree/admin/tax_settings_controller.rb
@@ -7,7 +7,7 @@
respond_to do |format|
format.html {
- redirect_to admin_tax_settings_path
+ redirect_to edit_admin_tax_settings_path
}
end
end
|
Fix - Shipment includes vat is allways false after save
Fixes #2368
|
diff --git a/features/step_definitions/bold_steps.rb b/features/step_definitions/bold_steps.rb
index abc1234..def5678 100644
--- a/features/step_definitions/bold_steps.rb
+++ b/features/step_definitions/bold_steps.rb
@@ -1,5 +1,5 @@ When /^I get the bold text for the "([^\"]*)" element$/ do |el|
- @b = @page.send "#{el}"
+ @b = @page.send "#{el}_id"
end
Then /^I should see "([^\"]*)" in bold$/ do |text|
|
Add support of <b> tag
|
diff --git a/spec/integration/start_page_spec.rb b/spec/integration/start_page_spec.rb
index abc1234..def5678 100644
--- a/spec/integration/start_page_spec.rb
+++ b/spec/integration/start_page_spec.rb
@@ -19,6 +19,7 @@ end
page.should have_selector(".article-container #test-report_a_problem")
+ page.should have_selector("#test-related")
end
end
end
|
Add test for related items on start page.
|
diff --git a/spec/lib/locales_validation_spec.rb b/spec/lib/locales_validation_spec.rb
index abc1234..def5678 100644
--- a/spec/lib/locales_validation_spec.rb
+++ b/spec/lib/locales_validation_spec.rb
@@ -1,6 +1,12 @@ RSpec.describe "locales files" do
it "should meet all locale validation requirements" do
- checker = RailsTranslationManager::LocaleChecker.new("config/locales/*/*.yml", %w[organisations.type])
+ skip_validation = %w[
+ organisations.content_item.schema_name
+ roles.heading
+ organisations.type
+ organisations.works_with_statement
+ ]
+ checker = RailsTranslationManager::LocaleChecker.new("config/locales/*/*.yml", skip_validation)
expect(checker.validate_locales).to be_truthy
end
end
|
Update the list of keys that should be skipped
This spec is running the same rake tasks. It needs it's own
list of excluded keys. See:
https://github.com/alphagov/rails_translation_manager/blob/e6d46f03cf1d9a75f852784aaab385ed48de1147/lib/rails_translation_manager/locale_checker.rb#L15
|
diff --git a/spec/lita/handlers/hal_9000_spec.rb b/spec/lita/handlers/hal_9000_spec.rb
index abc1234..def5678 100644
--- a/spec/lita/handlers/hal_9000_spec.rb
+++ b/spec/lita/handlers/hal_9000_spec.rb
@@ -1,4 +1,5 @@ require "spec_helper"
describe Lita::Handlers::Hal9000, lita_handler: true do
+ it { is_expected.to route_event(:unhandled_message) }
end
|
Add initial test to ensure routes event
|
diff --git a/spec/unit/relation/join_dsl_spec.rb b/spec/unit/relation/join_dsl_spec.rb
index abc1234..def5678 100644
--- a/spec/unit/relation/join_dsl_spec.rb
+++ b/spec/unit/relation/join_dsl_spec.rb
@@ -21,5 +21,29 @@ expect(result.to_a).
to eql([name: 'Jane', title: "Jane's task" ])
end
+
+ it 'works with right join' do
+ result = relation.right_join(users) { |tasks:, users: |
+ tasks[:user_id].is(users[:id]) & (users[:id] > 1)
+ }.select(:title, users[:name])
+
+ expect(result.to_a).
+ to eql([
+ { name: 'Joe', title: "Joe's task" },
+ { name: 'Jane', title: nil }
+ ])
+ end
+
+ it 'works with right join' do
+ result = users.left_join(tasks) { |tasks:, users: |
+ tasks[:user_id].is(users[:id]) & (tasks[:id] > 1)
+ }.select(relation[:title], :name)
+
+ expect(result.to_a).
+ to eql([
+ { name: 'Jane', title: "Jane's task" },
+ { name: 'Joe', title: nil },
+ ])
+ end
end
end
|
Add specs for left and right joins
|
diff --git a/spec/unit/trello/basic_data_spec.rb b/spec/unit/trello/basic_data_spec.rb
index abc1234..def5678 100644
--- a/spec/unit/trello/basic_data_spec.rb
+++ b/spec/unit/trello/basic_data_spec.rb
@@ -0,0 +1,18 @@+require 'spec_helper'
+
+RSpec.describe Trello::BasicData do
+
+ describe '.many' do
+ let(:association_name) { 'cards' }
+ let(:association_options) { { test: 'test' } }
+
+ it 'call build on AssociationBuilder::HasMany' do
+ expect(AssociationBuilder::HasMany)
+ .to receive(:build)
+ .with(Trello::BasicData, association_name, association_options)
+
+ Trello::BasicData.many(association_name, association_options)
+ end
+ end
+
+end
|
Add unit test for Trello::BasicData.many
|
diff --git a/db/migrate/20150406222613_add_attachment_avatar_to_users.rb b/db/migrate/20150406222613_add_attachment_avatar_to_users.rb
index abc1234..def5678 100644
--- a/db/migrate/20150406222613_add_attachment_avatar_to_users.rb
+++ b/db/migrate/20150406222613_add_attachment_avatar_to_users.rb
@@ -1,6 +1,7 @@ class AddAttachmentAvatarToUsers < ActiveRecord::Migration
def self.up
change_table :users do |t|
+ add_attachment :users, :avatar
add_column :users, :retina_dimensions, :text, after: :email
end
end
|
Fix migration adding avatar attachment
|
diff --git a/zencoder.gemspec b/zencoder.gemspec
index abc1234..def5678 100644
--- a/zencoder.gemspec
+++ b/zencoder.gemspec
@@ -14,8 +14,7 @@ s.summary = "Zencoder <http://zencoder.com> integration library."
s.description = "Zencoder <http://zencoder.com> integration library."
s.rubyforge_project = "zencoder"
- s.add_dependency "multi_json"
- s.add_dependency "json_pure"
+ s.add_dependency "active_support"
s.add_development_dependency "shoulda"
s.add_development_dependency "mocha"
s.add_development_dependency "webmock"
|
Change gemspec dependency from json libs to active support
|
diff --git a/spec/config_spec.rb b/spec/config_spec.rb
index abc1234..def5678 100644
--- a/spec/config_spec.rb
+++ b/spec/config_spec.rb
@@ -0,0 +1,54 @@+require 'client_helper'
+
+describe Cyclid::Client::Config do
+ it 'loads a valid configuration' do
+ config = nil
+ expect{ config = Cyclid::Client::Config.new(ENV['TEST_CONFIG']) }.to_not raise_error
+ expect(config.path).to eq(ENV['TEST_CONFIG'])
+ end
+
+ it 'loads a valid minimal configuration and sets defaults' do
+ test_config = {'server' => 'example.com',
+ 'organization' => 'test',
+ 'username' => 'leslie',
+ 'secret' => 'sekrit'}
+
+ allow(YAML).to receive(:load_file).and_return(test_config)
+
+ config = nil
+ expect{ config = Cyclid::Client::Config.new(ENV['TEST_CONFIG']) }.to_not raise_error
+ expect(config.server).to eq(test_config['server'])
+ expect(config.port).to eq(80)
+ expect(config.organization).to eq(test_config['organization'])
+ expect(config.username).to eq(test_config['username'])
+ expect(config.secret).to eq(test_config['secret'])
+ end
+
+ it 'loads a valid maximal configuration and does not set defaults' do
+ test_config = {'server' => 'example.com',
+ 'port' => '4242',
+ 'organization' => 'test',
+ 'username' => 'leslie',
+ 'secret' => 'sekrit'}
+
+ allow(YAML).to receive(:load_file).and_return(test_config)
+
+ config = nil
+ expect{ config = Cyclid::Client::Config.new(ENV['TEST_CONFIG']) }.to_not raise_error
+ expect(config.server).to eq(test_config['server'])
+ expect(config.port).to eq(test_config['port'])
+ expect(config.organization).to eq(test_config['organization'])
+ expect(config.username).to eq(test_config['username'])
+ expect(config.secret).to eq(test_config['secret'])
+ end
+
+ it 'fails gracefully if the configuration file is invalid' do
+ allow(YAML).to receive(:load_file).and_return(nil)
+
+ expect{ Cyclid::Client::Config.new(ENV['TEST_CONFIG']) }.to raise_error SystemExit
+ end
+
+ it 'fails gracefully if the configuration file can not be loaded' do
+ expect{ Cyclid::Client::Config.new('/invalid/config/file/path') }.to raise_error SystemExit
+ end
+end
|
Add tests specific to configuration files
|
diff --git a/lib/b2b_center_api/web_service/types/array_of_ids.rb b/lib/b2b_center_api/web_service/types/array_of_ids.rb
index abc1234..def5678 100644
--- a/lib/b2b_center_api/web_service/types/array_of_ids.rb
+++ b/lib/b2b_center_api/web_service/types/array_of_ids.rb
@@ -12,7 +12,7 @@ def self.from_response(response)
r = response.result
return if r.nil?
- r[:ids]
+ Array(r[:ids])
end
end
end
|
Fix bug returning Array of Ids
|
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -19,5 +19,10 @@ Capybara.default_selector = :xpath
end
end
+
+# Until this library is merge with capybara there needs to be local app and you need to add
+# 127.0.0.1 capybara-testapp.heroku.com to your host file
+# Run the app with the following line:
+# ruby -rrubygems lib/capybara/spec/extended_test_app.rb
REMOTE_TEST_HOST = "capybara-testapp.heroku.com"
REMOTE_TEST_URL = "http://#{REMOTE_TEST_HOST}:8070"
|
Add simple instructions to get the tests running
|
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,9 +1,9 @@ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
-require "codeclimate-test-reporter"
-CodeClimate::TestReporter.start
+require 'simplecov'
+SimpleCov.start
-require "panda_doc"
+require 'panda_doc'
RSpec.configure do |config|
# rspec-expectations config goes here. You can use an alternate
|
[Test] Replace deprecated CodeClimate::TestReporter by SimpleCov
|
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -23,3 +23,24 @@ PuppetlabsSpec::Files.cleanup
end
end
+
+require 'pathname'
+dir = Pathname.new(__FILE__).parent
+Puppet[:modulepath] = File.join(dir, 'fixtures', 'modules')
+
+# There's no real need to make this version dependent, but it helps find
+# regressions in Puppet
+#
+# 1. Workaround for issue #16277 where default settings aren't initialised from
+# a spec and so the libdir is never initialised (3.0.x)
+# 2. Workaround for 2.7.20 that now only loads types for the current node
+# environment (#13858) so Puppet[:modulepath] seems to get ignored
+# 3. Workaround for 3.5 where context hasn't been configured yet,
+# ticket https://tickets.puppetlabs.com/browse/MODULES-823
+#
+ver = Gem::Version.new(Puppet.version.split('-').first)
+if Gem::Requirement.new("~> 2.7.20") =~ ver || Gem::Requirement.new("~> 3.0.0") =~ ver || Gem::Requirement.new("~> 3.5") =~ ver
+ puts "augeasproviders: setting Puppet[:libdir] to work around broken type autoloading"
+ # libdir is only a single dir, so it can only workaround loading of one external module
+ Puppet[:libdir] = "#{Puppet[:modulepath]}/augeasproviders_core/lib"
+end
|
Use modulesync to manage meta files
|
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -11,4 +11,7 @@ config.before :all do
CreateAllTables.up unless ActiveRecord::Base.connection.table_exists? 'foos'
end
+ config.after :each do
+ [Foo, Bar, Baz].each{|m| m.delete_all }
+ end
end
|
Delete all records after each examples
|
diff --git a/lib/generators/stripe_webhooks/callback_generator.rb b/lib/generators/stripe_webhooks/callback_generator.rb
index abc1234..def5678 100644
--- a/lib/generators/stripe_webhooks/callback_generator.rb
+++ b/lib/generators/stripe_webhooks/callback_generator.rb
@@ -15,9 +15,9 @@ end
template 'callback.rb.erb', "app/callbacks/#{name.underscore}_callback.rb"
- if defined?(RSpec)
+ if defined?(RSpec) && Dir.exist?(Rails.root.join('spec'))
template 'callback_spec.rb.erb',
- "#{RSpec.configuration.default_path}/callbacks/#{name.underscore}_callback_spec.rb"
+ Rails.root.join('spec', 'callbacks', "#{name.underscore}_callback_spec.rb")
end
end
|
Fix issue in generator where RSpec.configuration is nil
|
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -11,6 +11,7 @@ conf.include Webrat::Methods
conf.include Webrat::Matchers
conf.before(:each) { WebMock.reset! }
+ conf.after(:each) { Timecop.return }
end
WebMock.disable_net_connect!
|
Reset Timecop after each spec
|
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -8,8 +8,8 @@ require_relative 'unit/connection/test_client'
# INSERT YOUR API KEYS HERE
-APIKEY = "key"
-PUB_APIKEY = "pubkey"
+APIKEY = ENV['MAILGUN_API_KEY']
+PUB_APIKEY = ENV['MAILGUN_PUBLIC_KEY']
APIHOST = "api.mailgun.net"
APIVERSION = "v2"
-SSL= true
+SSL = true
|
Use environment variables for API keys
Since we have to use our own keys to run the tests on this gem, support
using environment variables so we don’t have to edit this file and
remember to revert it back before committing. This way we can run tests
like:
`MAILGUN_API_KEY=abcd MAILGUN_PUBLIC_KEY=1234 bundle exec rspec`
|
diff --git a/db/fixtures/development/25_api_personal_access_token.rb b/db/fixtures/development/25_api_personal_access_token.rb
index abc1234..def5678 100644
--- a/db/fixtures/development/25_api_personal_access_token.rb
+++ b/db/fixtures/development/25_api_personal_access_token.rb
@@ -0,0 +1,15 @@+# frozen_string_literal: true
+
+require './spec/support/sidekiq'
+
+# Create an api access token for root user with the value: ypCa3Dzb23o5nvsixwPA
+Gitlab::Seeder.quiet do
+ PersonalAccessToken.create!(
+ user_id: User.find_by(username: 'root').id,
+ name: "seeded-api-token",
+ scopes: ["api"],
+ token_digest: "/O0jfLERYT/L5gG8nfByQxqTj43TeLlRzOtJGTzRsbQ="
+ )
+
+ print '.'
+end
|
Add seed for personal access token
|
diff --git a/db/migrate/20120419093427_add_kind_to_physical_roads.rb b/db/migrate/20120419093427_add_kind_to_physical_roads.rb
index abc1234..def5678 100644
--- a/db/migrate/20120419093427_add_kind_to_physical_roads.rb
+++ b/db/migrate/20120419093427_add_kind_to_physical_roads.rb
@@ -2,8 +2,8 @@ def change
add_column :physical_roads, :kind, :string
- ActiveRoad::PhysicalRoad.reset_column_information
- ActiveRoad::PhysicalRoad.update_all :kind => "road"
+ #ActiveRoad::PhysicalRoad.reset_column_information
+ #ActiveRoad::PhysicalRoad.update_all :kind => "road"
add_index :physical_roads, :kind
end
|
Delete lines which fails on Centos postgresql
|
diff --git a/db/migrate/20151208181322_add_released_at_to_episode.rb b/db/migrate/20151208181322_add_released_at_to_episode.rb
index abc1234..def5678 100644
--- a/db/migrate/20151208181322_add_released_at_to_episode.rb
+++ b/db/migrate/20151208181322_add_released_at_to_episode.rb
@@ -1,5 +1,5 @@ class AddReleasedAtToEpisode < ActiveRecord::Migration
def change
- add_column :episodes, :released_at, :timestamp
+ add_column :episodes, :released_at, :datetime
end
end
|
Use the same type as the last_build_date
|
diff --git a/db/migrate/20190212153345_change_export_id_to_bigint.rb b/db/migrate/20190212153345_change_export_id_to_bigint.rb
index abc1234..def5678 100644
--- a/db/migrate/20190212153345_change_export_id_to_bigint.rb
+++ b/db/migrate/20190212153345_change_export_id_to_bigint.rb
@@ -0,0 +1,9 @@+class ChangeExportIdToBigint < ActiveRecord::Migration[6.0]
+ def up
+ change_column :notifications, :export_id, :bigint
+ end
+
+ def down
+ change_column :notifications, :export_id, :integer
+ end
+end
|
Update export_id foreign key to bigint
|
diff --git a/rake/lib/rake/filelist.rb b/rake/lib/rake/filelist.rb
index abc1234..def5678 100644
--- a/rake/lib/rake/filelist.rb
+++ b/rake/lib/rake/filelist.rb
@@ -10,7 +10,9 @@ filenames.each do |fn|
case fn
when Array
- fn.each { |f| self << f }
+ fn.each { |f| self.add(f) }
+ when %r{[*?]}
+ add_matching(fn)
else
self << fn
end
@@ -22,6 +24,7 @@ Dir[pattern].each { |fn| self << fn } if pattern
end
end
+ private :add_matching
def to_s
self.join(' ')
|
Add now handles patterns as a special case.
Add_matching is now private.
git-svn-id: 6a2c20c72ceedae27ecedb68e90cd4f115192a7a@59 5af023f1-ac1a-0410-98d6-829a145c37ef
|
diff --git a/activerecord/lib/active_record/relation/predicate_builder.rb b/activerecord/lib/active_record/relation/predicate_builder.rb
index abc1234..def5678 100644
--- a/activerecord/lib/active_record/relation/predicate_builder.rb
+++ b/activerecord/lib/active_record/relation/predicate_builder.rb
@@ -23,8 +23,15 @@ attribute = arel_table[column] || Arel::Attribute.new(arel_table, column.to_sym)
case value
- when Array, Range, ActiveRecord::Associations::AssociationCollection, ActiveRecord::NamedScope::Scope
+ when Array, ActiveRecord::Associations::AssociationCollection, ActiveRecord::NamedScope::Scope
attribute.in(value)
+ when Range
+ # TODO : Arel should handle ranges with excluded end.
+ if value.exclude_end?
+ [attribute.gteq(value.begin), attribute.lt(value.end)]
+ else
+ attribute.in(value)
+ end
else
attribute.eq(value)
end
|
Handle Range with excluded end
|
diff --git a/lib/generators/shopify_app/templates/app/controllers/home_controller.rb b/lib/generators/shopify_app/templates/app/controllers/home_controller.rb
index abc1234..def5678 100644
--- a/lib/generators/shopify_app/templates/app/controllers/home_controller.rb
+++ b/lib/generators/shopify_app/templates/app/controllers/home_controller.rb
@@ -8,7 +8,7 @@ end
def index
- # get 5 products
+ # get 10 products
@products = ShopifyAPI::Product.find(:all, :params => {:limit => 10})
# get latest 5 orders
|
Comment shows right number of products
|
diff --git a/modules/openconnect/spec/classes/openconnect_spec.rb b/modules/openconnect/spec/classes/openconnect_spec.rb
index abc1234..def5678 100644
--- a/modules/openconnect/spec/classes/openconnect_spec.rb
+++ b/modules/openconnect/spec/classes/openconnect_spec.rb
@@ -0,0 +1,29 @@+require_relative '../../../../spec_helper'
+
+describe 'openconnect', :type => :class do
+ let(:path_init) { '/etc/init/openconnect.conf' }
+ let(:path_passwd) { '/etc/openconnect/network.passwd' }
+ let(:default_params) {{
+ :gateway => '1.2.3.4',
+ :user => 'johnsmith',
+ :password => 'password123',
+ }}
+
+ context 'with required params' do
+ let(:params) { default_params }
+
+ it { should contain_file(path_init) }
+ it { should contain_file(path_passwd).with_content('password123') }
+
+ it { should_not contain_file(path_init).with_content(/DNS_UPDATE/) }
+ it { should_not contain_file(path_init).with_content(/--CAfile/) }
+ end
+
+ context 'with dnsupdate => yes' do
+ let(:params) { default_params.merge({
+ :dnsupdate => 'yes',
+ })}
+
+ it { should contain_file(path_init).with_content(/DNS_UPDATE=yes/) }
+ end
+end
|
Add spec tests for OpenConnect
We have logic in a template. So I'd be a lot happier if we had
positive/negative tests for the desired behaviour.
|
diff --git a/lib/rails_core_extensions/active_record_liquid_extensions.rb b/lib/rails_core_extensions/active_record_liquid_extensions.rb
index abc1234..def5678 100644
--- a/lib/rails_core_extensions/active_record_liquid_extensions.rb
+++ b/lib/rails_core_extensions/active_record_liquid_extensions.rb
@@ -10,7 +10,7 @@ field = field.to_sym
before_validation do |record|
begin
- Liquid::Template.parse(record.send(field), error_mode: strict)
+ Liquid::Template.parse(record.send(field), error_mode: :strict)
rescue Liquid::SyntaxError => e
record.errors.add(field, "Liquid Syntax Error: #{e}")
end
|
Fix passing of symbol to liquid template
|
diff --git a/Library/Homebrew/cmd/sh.rb b/Library/Homebrew/cmd/sh.rb
index abc1234..def5678 100644
--- a/Library/Homebrew/cmd/sh.rb
+++ b/Library/Homebrew/cmd/sh.rb
@@ -16,7 +16,6 @@ end
ENV['PS1'] = 'brew \[\033[1;32m\]\w\[\033[0m\]$ '
ENV['VERBOSE'] = '1'
- ENV['HOMEBREW_LOG'] = '1'
puts <<-EOS.undent_________________________________________________________72
Your shell has been configured to use Homebrew's build environment:
this should help you build stuff. Notably though, the system versions of
|
Remove ENV variable that is no longer used
|
diff --git a/features/step_definitions/git_files_step_definitions.rb b/features/step_definitions/git_files_step_definitions.rb
index abc1234..def5678 100644
--- a/features/step_definitions/git_files_step_definitions.rb
+++ b/features/step_definitions/git_files_step_definitions.rb
@@ -0,0 +1,8 @@+World(Aruba::Api)
+
+Given(/^an empty, committed file named "(.*?)"$/) do |file_name|
+ write_file(file_name, "")
+ in_current_dir do
+ `git add "#{file_name}"`
+ end
+end
|
Add step definition to add files to Git
|
diff --git a/features/support/page_models/page_actions/footer_actions.rb b/features/support/page_models/page_actions/footer_actions.rb
index abc1234..def5678 100644
--- a/features/support/page_models/page_actions/footer_actions.rb
+++ b/features/support/page_models/page_actions/footer_actions.rb
@@ -1,13 +1,21 @@-def click_author_link_on_footer(author_name)
- link = current_page.footer.author_by_name(author_name)
- !link.nil? ? link.click : raise("Unable to find an author by name #{author_name}")
+module PageModels
+ module FooterActions
+
+ def click_author_link_on_footer(author_name)
+ link = current_page.footer.author_by_name(author_name)
+ !link.nil? ? link.click : raise("Unable to find an author by name #{author_name}")
+ end
+
+ def click_category_link_on_footer(category_name)
+ link = current_page.footer.category_by_name(category_name)
+ !link.nil? ? link.click : raise("Unable to find category by name #{category_name}")
+ end
+
+ def click_footer_link(link_name)
+ current_page.footer.navigate_by_link(link_name)
+ end
+
+ end
end
-def click_category_link_on_footer(category_name)
- link = current_page.footer.category_by_name(category_name)
- !link.nil? ? link.click : raise("Unable to find category by name #{category_name}")
-end
-
-def click_footer_link(link_name)
- current_page.footer.navigate_by_link link_name
-end+World(PageModels::FooterActions)
|
Correct format in footer actions
|
diff --git a/nanoc/lib/nanoc/base/services/compiler/stages/build_reps.rb b/nanoc/lib/nanoc/base/services/compiler/stages/build_reps.rb
index abc1234..def5678 100644
--- a/nanoc/lib/nanoc/base/services/compiler/stages/build_reps.rb
+++ b/nanoc/lib/nanoc/base/services/compiler/stages/build_reps.rb
@@ -5,6 +5,9 @@ class Compiler
module Stages
class BuildReps < Nanoc::Core::CompilationStage
+ include Nanoc::Core::ContractsSupport
+
+ contract C::KeywordArgs[site: Nanoc::Core::Site, action_provider: Nanoc::Core::ActionProvider] => C::Any
def initialize(site:, action_provider:)
@site = site
@action_provider = action_provider
|
Refactor: Add contracts to BuildReps stage
|
diff --git a/config/routes.rb b/config/routes.rb
index abc1234..def5678 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -2,6 +2,7 @@ backend_resources :download_categories
backend_resources :downloads do
member { get :download }
+ member { post :toggle_published }
end
root to: 'home#index'
|
Add route to toggle published status.
|
diff --git a/config/routes.rb b/config/routes.rb
index abc1234..def5678 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -24,7 +24,7 @@ # get "/auth/github/callback", to: "sessions#create"
# get "/sign_out", to: "sessions#destroy"
- get "/pages/*id" => "pages#show", as: :page, format: false
+ get "/pages/*id" => "pages#show", as: :pages, format: false
%w(404 422 500).each do |status_code|
get status_code, to: "errors#show", code: status_code
|
Use the plural for path helpers
|
diff --git a/test/specialization_breadcrumb_test.rb b/test/specialization_breadcrumb_test.rb
index abc1234..def5678 100644
--- a/test/specialization_breadcrumb_test.rb
+++ b/test/specialization_breadcrumb_test.rb
@@ -1,6 +1,12 @@ require 'test_helper'
describe 'Redis::Breadcrumb' do
+ class SpecializedBreadcrumb < Redis::Breadcrumb
+ tracked_in 'widget:<id>:tracking'
+
+ owns 'widget:<id>'
+ end
+
before do
redis = MockRedis.new
@@ -8,16 +14,23 @@ end
it 'can specialize tracked_in key name' do
- class SpecializedBreadcrumb < Redis::Breadcrumb
- tracked_in 'widget:<id>'
- end
-
obj = Object.new
class << obj
def id; "foo"; end
end
- assert_equal 'widget:foo', SpecializedBreadcrumb.new(obj).tracked_in
+ assert_equal 'widget:foo:tracking', SpecializedBreadcrumb.new(obj).tracked_in
+ end
+
+ it 'can specialize owned key names' do
+ obj = Object.new
+ class << obj
+ def id; "foo"; end
+ end
+
+ breadcrumb = SpecializedBreadcrumb.new obj
+
+ assert_equal ['widget:foo'], breadcrumb.owned_keys
end
end
|
Add test 'can specialize owned key names'
|
diff --git a/spec/controllers/hanuman/api/v1/questions_controller_spec.rb b/spec/controllers/hanuman/api/v1/questions_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/hanuman/api/v1/questions_controller_spec.rb
+++ b/spec/controllers/hanuman/api/v1/questions_controller_spec.rb
@@ -18,4 +18,31 @@ expect(response).to be_success
end
end
+
+
+ describe 'PUT#update' do
+ context 'with valid params' do
+ let(:valid_params_to_update) {{helper_text: "This is text"}}
+ it "updates the question" do
+ # Assuming there are no other questions in the database, this
+ # specifies that the Hanuman::SurveyTemplate created on the previous line
+ # receives the :update_attributes message with whatever params are
+ # submitted in the request.
+ allow_any_instance_of(Hanuman::Question).to receive(:update).with(valid_params_to_update)
+ put :update, id: question, question: valid_params_to_update
+ expect(response).to be_success
+ question.reload
+ expect(question.helper_text).to eql('This is text')
+ end
+ end
+
+ context 'with invalid params' do
+ let(:invalid_params_to_update) {{question_text: nil}}
+ it 'returns the error message' do
+ put :update, id: question, question: invalid_params_to_update
+ expect(response).not_to be_success
+ expect(json['errors']).not_to be_nil
+ end
+ end
+ end
end
|
Add missing tests for questions controller under v1 api
|
diff --git a/spec/higher_level_api/integration/publisher_confirms_spec.rb b/spec/higher_level_api/integration/publisher_confirms_spec.rb
index abc1234..def5678 100644
--- a/spec/higher_level_api/integration/publisher_confirms_spec.rb
+++ b/spec/higher_level_api/integration/publisher_confirms_spec.rb
@@ -29,7 +29,8 @@
ch.next_publish_seq_no.should == 5001
ch.wait_for_confirms
-
+ sleep 0.25
+
q.message_count.should == 5000
q.purge
|
Insert a brief sleep to allow all messages to be confirmed before message_count is called
|
diff --git a/trove.gemspec b/trove.gemspec
index abc1234..def5678 100644
--- a/trove.gemspec
+++ b/trove.gemspec
@@ -9,7 +9,7 @@ spec.authors = ["query-string"]
spec.email = ["atimofeev@reactant.ru"]
spec.summary = %q{Simple wrapper for interacting with Trove (http://trove.nla.gov.au/) API}
- spec.description = %q{API overview http://help.nla.gov.au/trove/building-with-trove/api}
+ spec.description = %q{API overview http://help.nla.gov.au/trove/building-with-trove/api-technical-guide}
spec.homepage = ""
spec.license = "MIT"
|
Change API link to full technical guide
|
diff --git a/app/controllers/uramon_article_viewer/articles_controller.rb b/app/controllers/uramon_article_viewer/articles_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/uramon_article_viewer/articles_controller.rb
+++ b/app/controllers/uramon_article_viewer/articles_controller.rb
@@ -8,12 +8,13 @@ before_filter :setup_connection
def index
- response = @connection.get("/articles.json")
+ response = @connection.get("/admin/articles.json")
+ p response.body
@articles = JSON.parse(response.body)
end
def show
- response = @connection.get("/articles/1.json")
+ response = @connection.get("/admin/articles/1.json")
@article = JSON.parse(response.body)
end
|
Add "/admin" prefix to path for article_manager
|
diff --git a/lib/i18n/workflow/translation_helper.rb b/lib/i18n/workflow/translation_helper.rb
index abc1234..def5678 100644
--- a/lib/i18n/workflow/translation_helper.rb
+++ b/lib/i18n/workflow/translation_helper.rb
@@ -4,11 +4,11 @@ module TranslationHelper
def translate_with_rescue_format(key, options = {})
- translate_without_rescue_format(key, options.merge(rescue_format: true))
+ translate_without_rescue_format(key, options.merge(raise: false))
end
def t(key, options = {})
- translate_without_rescue_format(key, options.merge(rescue_format: true))
+ translate_without_rescue_format(key, options.merge(raise: false))
end
alias_method_chain :translate, :rescue_format
|
Fix issues with missing translation handling
Updates to I18n and ActionView seem to have changed the behaviour. We always need to provide the `raise: false` option to activate the custom exception handler.
|
diff --git a/lib/kosmos/packages/tac_life_support.rb b/lib/kosmos/packages/tac_life_support.rb
index abc1234..def5678 100644
--- a/lib/kosmos/packages/tac_life_support.rb
+++ b/lib/kosmos/packages/tac_life_support.rb
@@ -2,6 +2,7 @@ title 'TAC Life Support (WIP)'
aliases 'tac life support'
url 'https://github.com/taraniselsu/TacLifeSupport/releases/download/Release_v0.8/TacLifeSupport_0.8.0.4.zip'
+ prerequisites 'module-manager'
def install
merge_directory 'GameData'
|
Add ModuleManager dependence to TAC Life.
|
diff --git a/lib/swagger/docs/generator/generator.rb b/lib/swagger/docs/generator/generator.rb
index abc1234..def5678 100644
--- a/lib/swagger/docs/generator/generator.rb
+++ b/lib/swagger/docs/generator/generator.rb
@@ -41,7 +41,7 @@ end
def agregate_metadata
- case Rails.env
+ case defined?(Rails) && Rails.env
when 'production' || 'test'
write_inswagger_file.to_json
else
|
Fix test Rails class exists
|
diff --git a/lib/tritium/parser/instructions/base.rb b/lib/tritium/parser/instructions/base.rb
index abc1234..def5678 100644
--- a/lib/tritium/parser/instructions/base.rb
+++ b/lib/tritium/parser/instructions/base.rb
@@ -49,7 +49,7 @@ end
def returns
- spec.returns
+ spec.returns || "Text"
end
def delete
|
Set a default return type to "Text"
|
diff --git a/lib/device_recipes/automated_architecture/siren_of_shame.rb b/lib/device_recipes/automated_architecture/siren_of_shame.rb
index abc1234..def5678 100644
--- a/lib/device_recipes/automated_architecture/siren_of_shame.rb
+++ b/lib/device_recipes/automated_architecture/siren_of_shame.rb
@@ -3,14 +3,12 @@ module SirenOfShame
def success!
- # Ding! sound and fade lights for 10 seconds
- set_audio_pattern(2, 10)
- set_flash_pattern(3, 10)
+ stop
end
def failure!
- # Sad trombone sound for 10 seconds and Chase lights
- set_audio_pattern(1, 10)
+ # Sad trombone sound for 5 seconds and Chase lights
+ set_audio_pattern(1, 5)
set_flash_pattern(4, 999)
end
|
Remove sound and audio for success and reduce audio time to 5 seconds
|
diff --git a/lib/puppet/provider/netscaler_lbvserver_service_bind/rest.rb b/lib/puppet/provider/netscaler_lbvserver_service_bind/rest.rb
index abc1234..def5678 100644
--- a/lib/puppet/provider/netscaler_lbvserver_service_bind/rest.rb
+++ b/lib/puppet/provider/netscaler_lbvserver_service_bind/rest.rb
@@ -36,4 +36,12 @@
message
end
+
+ def destroy
+ toname, fromname = resource.name.split('/').map { |n| URI.escape(n) }
+ result = Puppet::Provider::Netscaler.delete("/config/#{netscaler_api_type}/#{toname}",{'args'=>"servicename:#{fromname}"})
+ @property_hash.clear
+
+ return result
+ end
end
|
Fix for lbvserver_service_bind destroy issues
|
diff --git a/app/api/pushificator/v1.rb b/app/api/pushificator/v1.rb
index abc1234..def5678 100644
--- a/app/api/pushificator/v1.rb
+++ b/app/api/pushificator/v1.rb
@@ -11,6 +11,7 @@ before do
header['Access-Control-Allow-Origin'] = '*'
header['Access-Control-Request-Method'] = '*'
+ header['Access-Control-Allow-Headers'] = 'Access-Control-Allow-Origin, Access-Control-Allow-Headers, Access-Control-Request-Method'
end
helpers do
|
Add CORS header to api
|
diff --git a/app/models/feedback_sms.rb b/app/models/feedback_sms.rb
index abc1234..def5678 100644
--- a/app/models/feedback_sms.rb
+++ b/app/models/feedback_sms.rb
@@ -9,7 +9,7 @@ end
def address
- "1234 Lincoln Way West"
+ "#{property_number} Lincoln Way West"
end
def property_number
|
Make address a simple function of input property code (always same street for testing)
|
diff --git a/lib/consistency_fail/enforcer.rb b/lib/consistency_fail/enforcer.rb
index abc1234..def5678 100644
--- a/lib/consistency_fail/enforcer.rb
+++ b/lib/consistency_fail/enforcer.rb
@@ -15,7 +15,8 @@ models.preload_all
introspectors = [ConsistencyFail::Introspectors::ValidatesUniquenessOf.new,
- ConsistencyFail::Introspectors::HasOne.new]
+ ConsistencyFail::Introspectors::HasOne.new,
+ ConsistencyFail::Introspectors::Polymorphic.new]
problem_models_exist = models.all.detect do |model|
introspectors.any? {|i| !i.missing_indexes(model).empty?}
|
Add polymorphic has_one to the Enforcer
|
diff --git a/app/controllers/email_configurations_controller.rb b/app/controllers/email_configurations_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/email_configurations_controller.rb
+++ b/app/controllers/email_configurations_controller.rb
@@ -25,8 +25,8 @@ end
def try_email
- output = Java::OrgRsnaIsnUtil::EmailUtil.send(params[:email],"Test email","This test message was sent from the isn image sharing server.")
- render :text => "<pre class=\"well\">#{output}</pre>"
+ output = CGI::escapeHTML(Java::OrgRsnaIsnUtil::EmailUtil.send(params[:email],"Test email","This test message was sent from the isn image sharing server."))
+ render :text => "<pre>#{output}</pre>"
end
private
|
Fix email test output formating
|
diff --git a/railties/test/generators/integration_test_generator_test.rb b/railties/test/generators/integration_test_generator_test.rb
index abc1234..def5678 100644
--- a/railties/test/generators/integration_test_generator_test.rb
+++ b/railties/test/generators/integration_test_generator_test.rb
@@ -3,10 +3,14 @@
class IntegrationTestGeneratorTest < Rails::Generators::TestCase
include GeneratorsTestHelper
- arguments %w(integration)
def test_integration_test_skeleton_is_created
- run_generator
+ run_generator %w(integration)
assert_file "test/integration/integration_test.rb", /class IntegrationTest < ActionDispatch::IntegrationTest/
end
+
+ def test_namespaced_integration_test_skeleton_is_created
+ run_generator %w(iguchi/integration)
+ assert_file "test/integration/iguchi/integration_test.rb", /class Iguchi::IntegrationTest < ActionDispatch::IntegrationTest/
+ end
end
|
Add test for generate namespaced integration test
|
diff --git a/vagrant.rb b/vagrant.rb
index abc1234..def5678 100644
--- a/vagrant.rb
+++ b/vagrant.rb
@@ -5,6 +5,7 @@ sudo apt-get -qq update
sudo DEBIAN_FRONTEND=noninteractive apt-get -qq -y install chef
sudo DEBIAN_FRONTEND=noninteractive apt-get -qq -y install exim4-base
+ sudo DEBIAN_FRONTEND=noninteractive apt-get -qq -y install mailutils
sudo DEBIAN_FRONTEND=noninteractive apt-get -qq -y install shellcheck
sudo DEBIAN_FRONTEND=noninteractive apt-get -qq -y install snmp
# v2 is the last version that works with Ruby 2.1:
|
Install mailutils, required for tests of sys::mail
|
diff --git a/spec/acceptance_tests/suite_2/application_tours_spec.rb b/spec/acceptance_tests/suite_2/application_tours_spec.rb
index abc1234..def5678 100644
--- a/spec/acceptance_tests/suite_2/application_tours_spec.rb
+++ b/spec/acceptance_tests/suite_2/application_tours_spec.rb
@@ -33,8 +33,7 @@
it 'does not show the tour after closing it', js: true do
tour_should_be_visible
- find('.hopscotch-close').click
- tour_should_not_be_visible
+ close_tour
visit read_path
# wait for client code to initialize
|
Use helper function instead of manually accessing the DOM to close tour.
|
diff --git a/lib/flightaware/client/client.rb b/lib/flightaware/client/client.rb
index abc1234..def5678 100644
--- a/lib/flightaware/client/client.rb
+++ b/lib/flightaware/client/client.rb
@@ -18,10 +18,10 @@ attr_reader :bytes
attr_reader :pkts
- def initialize(config, out = nil)
+ def initialize(config)
@bytes = 0
@pkts = 0
- @out = out || Proc.new{|buf| $stdout.puts(buf) }
+ @out = config.feed_one
$stderr.puts("Connecting to #{config.site}:#{config.port} using TLS.")
raw_socket = TCPSocket.new(config.site, config.port)
|
Use the new interface for callback def.
|
diff --git a/Casks/printer-pro-desktop.rb b/Casks/printer-pro-desktop.rb
index abc1234..def5678 100644
--- a/Casks/printer-pro-desktop.rb
+++ b/Casks/printer-pro-desktop.rb
@@ -0,0 +1,11 @@+cask :v1 => 'printer-pro-desktop' do
+ version '1.3.7'
+ sha256 '6baa80352c3756824972a6aac8ebdabebcc082f693018d04a7a95f062565e704'
+
+ url "https://support.readdle.com/ppd/PrinterProDesktop-#{version.gsub('.', '_')}.dmg"
+ name 'Printer Pro Desktop'
+ homepage 'https://support.readdle.com/ppd/'
+ license :gratis
+
+ app 'Printer Pro Desktop.app'
+end
|
Add Printer Pro Desktop v1.3.7
|
diff --git a/lib/mongoid_auto_increment_id.rb b/lib/mongoid_auto_increment_id.rb
index abc1234..def5678 100644
--- a/lib/mongoid_auto_increment_id.rb
+++ b/lib/mongoid_auto_increment_id.rb
@@ -3,16 +3,15 @@ include Components
end
- class Identity
- protected
- def generate_id
- table_name = @document.class.to_s.tableize
- o = Counter.collection.find_and_modify({:query => {:_id => table_name},
- :update => {:$inc => {:c => 1}},
- :new => true,
- :upsert => true})
- o["c"]
- end
+ class Identity
+ def generate_id
+ table_name = @document.class.to_s.tableize
+ o = Counter.collection.find_and_modify({:query => {:_id => table_name},
+ :update => {:$inc => {:c => 1}},
+ :new => true,
+ :upsert => true})
+ Criterion::Unconvertable.new(o["c"].to_s)
+ end
end
module Document
@@ -21,7 +20,7 @@
def as_document
if attributes["_id"].blank?
- attributes["_id"] = Identity.new(self).create
+ attributes["_id"] = Identity.new(self).generate_id
end
attributes.tap do |attrs|
relations.each_pair do |name, meta|
|
Fix relation Model id convert bug.
|
diff --git a/test/daliagraphite_test.rb b/test/daliagraphite_test.rb
index abc1234..def5678 100644
--- a/test/daliagraphite_test.rb
+++ b/test/daliagraphite_test.rb
@@ -0,0 +1,29 @@+require "minitest/unit"
+require "minitest/autorun"
+require "mocha/setup"
+require_relative "../lib/daliagraphite"
+
+class DaliaGraphiteTest < MiniTest::Unit::TestCase
+
+ def test_datapoint
+ Dalia::MiniGraphite.config({ :graphite_host => "graphite.it.daliaresearch.com", :graphite_port => 2003 })
+
+ socket_mock = mock()
+ TCPSocket.expects(:new).with("graphite.it.daliaresearch.com", 2003).returns(socket_mock)
+ socket_mock.expects(:print).with("test.age 31 1357117860\n")
+ socket_mock.expects(:close)
+
+ Dalia::MiniGraphite.datapoint("test.age", 31, Time.parse("2013-01-02 10:11"))
+ end
+
+ def test_counter
+ Dalia::MiniGraphite.config({ :statsd_host => "graphite.it.daliaresearch.com", :statsd_port => 8125 })
+
+ socket_mock = mock()
+ UDPSocket.expects(:new).returns(socket_mock)
+ socket_mock.expects(:send).with("height:231|c", 0, "graphite.it.daliaresearch.com", 8125 )
+
+ Dalia::MiniGraphite.counter("height", 231)
+ end
+
+end
|
Implement basic tests for datapoint and counter methods
|
diff --git a/lib/rails_sequel/rails_sequel.rb b/lib/rails_sequel/rails_sequel.rb
index abc1234..def5678 100644
--- a/lib/rails_sequel/rails_sequel.rb
+++ b/lib/rails_sequel/rails_sequel.rb
@@ -33,6 +33,8 @@ # MSSQL support
options[:db_type] = config[:db_type] if config[:db_type]
options[:socket] = config[:socket] if config[:socket]
+ options[:charset] = config[:charset] if config[:charset]
+ options[:encoding] = config[:encoding] if config[:encoding]
options[:loggers] = [Rails.logger]
options
end
|
Add :charset and :encoding options
Signed-off-by: Piotr Usewicz <2c0eb4a25a7cde333ff2d0860cb06051925fd74f@layer22.com>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.