diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/shared/git_monkey_patches.rb b/shared/git_monkey_patches.rb index abc1234..def5678 100644 --- a/shared/git_monkey_patches.rb +++ b/shared/git_monkey_patches.rb @@ -14,16 +14,20 @@ # 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. - class Lib + class Lib # Monkey patch ls_files until https://github.com/ruby-git/ruby-git/pull/320 is resolved - def ls_files(location=nil) - location ||= '.' + def ls_files(location = nil) + location ||= "." hsh = {} - command_lines('ls-files', ['--stage', location]).each do |line| + command_lines("ls-files", ["--stage", location]).each do |line| (info, file) = line.split("\t") (mode, sha, stage) = info.split + + # rubocop:disable Security/Eval file = eval(file) if file =~ /^\".*\"$/ # This takes care of quoted strings returned from git - hsh[file] = {:path => file, :mode_index => mode, :sha_index => sha, :stage => stage} + # rubocop:enable Security/Eval + + hsh[file] = { path: file, mode_index: mode, sha_index: sha, stage: stage } end return hsh end
Fix code style to make rubocop happy for git monkey patch
diff --git a/merb-parts/lib/merb-parts/part_controller.rb b/merb-parts/lib/merb-parts/part_controller.rb index abc1234..def5678 100644 --- a/merb-parts/lib/merb-parts/part_controller.rb +++ b/merb-parts/lib/merb-parts/part_controller.rb @@ -17,7 +17,7 @@ self._subclasses = Set.new def self.subclasses_list() _subclasses end - self._template_root = File.expand_path(self._template_root / "../parts/views") + self._template_root = Merb.dir_for(:part) / "views" def _template_location(action, type = nil, controller = controller_name) "#{controller}/#{action}.#{type}"
Use a better path for template root.
diff --git a/test/models/cat3_filter_task_test.rb b/test/models/cat3_filter_task_test.rb index abc1234..def5678 100644 --- a/test/models/cat3_filter_task_test.rb +++ b/test/models/cat3_filter_task_test.rb @@ -13,11 +13,12 @@ end def test_task_good_results_should_pass + user = User.create(email: 'vendor@test.com', password: 'TestTest!', password_confirmation: 'TestTest!', terms_and_conditions: '1') task = @product_test.tasks.create({ expected_results: @product_test.expected_results }, Cat3FilterTask) xml = Tempfile.new(['good_results_debug_file', '.xml']) xml.write task.good_results perform_enqueued_jobs do - te = task.execute(xml, User.first) + te = task.execute(xml, user) te.reload assert_empty te.execution_errors, 'test execution with known good results should not have any errors' assert te.passing?, 'test execution with known good results should pass'
Add user to task execution
diff --git a/app/loaders/twitter_loader.rb b/app/loaders/twitter_loader.rb index abc1234..def5678 100644 --- a/app/loaders/twitter_loader.rb +++ b/app/loaders/twitter_loader.rb @@ -24,10 +24,13 @@ private def validate_options! - options_or_defaults.each do |option_name| - next if options_or_defaults[option_name].present? - raise "required option '#{option_name}' is not defined" - end + return if undefined_options.empty? + undefined_list = undefined_options.join(', ') + raise "required options not found: #{undefined_list}" + end + + def undefined_options + options_or_defaults.select { |opt| !options_or_defaults[opt] } end def client @@ -37,7 +40,7 @@ def twitter_user feed.options.fetch('twitter_user') rescue KeyError - raise "'twitter_user' option is not defined for '#{feed.name}' feed" + raise "'twitter_user' option not defined in '#{feed.name}' feed options" end def options_or_defaults
Improve options validation for TwitterLoader
diff --git a/app/models/article_edition.rb b/app/models/article_edition.rb index abc1234..def5678 100644 --- a/app/models/article_edition.rb +++ b/app/models/article_edition.rb @@ -19,7 +19,7 @@ end def rendering_app - "news" + "www" end end
Change article rendering app to www
diff --git a/rb/lib/selenium/webdriver/common/zipper.rb b/rb/lib/selenium/webdriver/common/zipper.rb index abc1234..def5678 100644 --- a/rb/lib/selenium/webdriver/common/zipper.rb +++ b/rb/lib/selenium/webdriver/common/zipper.rb @@ -36,7 +36,10 @@ entry = file.sub("#{path}/", '') zos.put_next_entry(entry) - zos << File.read(file, "rb") + File.open(file, "rb") do |io| + zos << io.read + end + end zos.close
JariBakken: Fix last commit (at least for OS X/Ubuntu) git-svn-id: aa1aa1384423cb28c2b1e29129bb3a91de1d9196@11359 07704840-8298-11de-bf8c-fd130f914ac9
diff --git a/test/unit/locales_validation_test.rb b/test/unit/locales_validation_test.rb index abc1234..def5678 100644 --- a/test/unit/locales_validation_test.rb +++ b/test/unit/locales_validation_test.rb @@ -2,7 +2,7 @@ class LocalesValidationTest < ActiveSupport::TestCase test "should validate all locale files" do - checker = RailsTranslationManager::LocaleChecker.new("config/locales/*.yml", ["homepage", "formats.transaction"]) + checker = RailsTranslationManager::LocaleChecker.new("config/locales/*.yml", ["formats.transaction"]) assert checker.validate_locales end end
Remove 'homepage' override in 'LocaleChecker' Previously, we ignored all locale properties beginning with the 'homepage' prefix, for several reasons: 1) The locale files lost the traditional key/value structure in 51a5b885a21fa1e6da9c7d8092da9a814227058e, meaning Rails Translation Manager is unable to statically analyse which properties are used, and it complained of certain keys being unused. 2) Said keys have now been removed. 3) The English and Welsh keys weren't in sync, so the checker was complaining about that. That has now been fixed in the previous commits.
diff --git a/model/Cargo/itinerary.rb b/model/Cargo/itinerary.rb index abc1234..def5678 100644 --- a/model/Cargo/itinerary.rb +++ b/model/Cargo/itinerary.rb @@ -33,15 +33,20 @@ # Checks whether provided event is expected according to this itinerary specification. def is_expected(handling_event) if (handling_event.event_type == "Load") - # TODO How to search the legs for a matching location? - # .NET: legs.Any(x => x.load_location == handling_event.location); - locations = Hash.new - legs.each do |leg| - locations[leg.load_location] = 1 - end - return locations.has_key?(handling_event.location) + return legs_contain_load_location?(handling_event.location) end false + end + + # TODO Replace this horrible hack with correct Ruby idiom for + # quering an array. How to search the legs for a matching location? + # .NET: legs.Any(x => x.load_location == handling_event.location); + def legs_contain_load_location?(handling_event_location) + locations = Hash.new + legs.each do |leg| + locations[leg.load_location] = 1 + end + return locations.has_key?(handling_event_location) end def ==(other)
Isolate nasty search for leg unload location.
diff --git a/hippo_xml_parser.gemspec b/hippo_xml_parser.gemspec index abc1234..def5678 100644 --- a/hippo_xml_parser.gemspec +++ b/hippo_xml_parser.gemspec @@ -4,22 +4,23 @@ require 'hippo_xml_parser/version' Gem::Specification.new do |spec| - spec.name = "hippo_xml_parser" + spec.name = 'hippo_xml_parser' spec.version = HippoXmlParser::VERSION - spec.authors = ["Jared Fraser"] - spec.email = ["dev@jsf.io"] + spec.authors = ['Jared Fraser'] + spec.email = ['dev@jsf.io'] spec.summary = %q{Parser for Hippo XML exports} spec.description = %q{} - spec.homepage = "" - spec.license = "MIT" + spec.homepage = '' + spec.license = 'MIT' spec.files = `git ls-files -z`.split("\x0") spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) - spec.require_paths = ["lib"] + spec.require_paths = ['lib'] - spec.add_dependency "nokogiri" + spec.add_dependency 'nokogiri' - spec.add_development_dependency "bundler", "~> 1.6" - spec.add_development_dependency "rake" + spec.add_development_dependency 'bundler', '~> 1.6' + spec.add_development_dependency 'rake' + spec.add_development_dependency 'rspec', '~> 3.1' end
Add rspec to development dependencies
diff --git a/lib/active_set/processors/paginate_processor.rb b/lib/active_set/processors/paginate_processor.rb index abc1234..def5678 100644 --- a/lib/active_set/processors/paginate_processor.rb +++ b/lib/active_set/processors/paginate_processor.rb @@ -18,14 +18,14 @@ end def instruction - Instructions::Entry.new(page_number, pagesize) + Instructions::Entry.new(page_number, page_size) end def page_number @instructions.get(:page) || 1 end - def pagesize + def page_size @instructions.get(:size) || 25 end end
Change method name in PaginateProcessor to page_size to match adapter semantics
diff --git a/swftly.gemspec b/swftly.gemspec index abc1234..def5678 100644 --- a/swftly.gemspec +++ b/swftly.gemspec @@ -2,8 +2,8 @@ spec.name = 'swftly' spec.version = '0.1.1' spec.summary = "swftly abstracts and automates interactions with Swiffy, Google's hosted swf converter." - spec.description = "The summary summarizes sumarily." - spec.platform = Gem::Platform::CURRENT + spec.description = "swftly abstracts and automates interactions with Swiffy, Google's hosted swf converter." + spec.platform = Gem::Platform::RUBY spec.require_path = '.' spec.authors = ["jnf"] spec.email = 'jeremy.flores@gmail.com'
Add a simple description for rubygems and change platform to RUBY.
diff --git a/interactor-rails.gemspec b/interactor-rails.gemspec index abc1234..def5678 100644 --- a/interactor-rails.gemspec +++ b/interactor-rails.gemspec @@ -17,6 +17,6 @@ spec.add_dependency "interactor", "~> 3.0" spec.add_dependency "rails", ">= 3", "< 5.1" - spec.add_development_dependency "bundler", "~> 1.7" - spec.add_development_dependency "rake", "~> 10.3" + spec.add_development_dependency "bundler", "~> 1.11" + spec.add_development_dependency "rake", "~> 11.1" end
Update to the latest versions of bundler and rake
diff --git a/app/workers/publisher_poll.rb b/app/workers/publisher_poll.rb index abc1234..def5678 100644 --- a/app/workers/publisher_poll.rb +++ b/app/workers/publisher_poll.rb @@ -9,13 +9,12 @@ MAX_PAGE_NUMBER = 10 NEXT_PAGE_HEADER = 'Next-Page'.freeze - def perform(publisher_id, endpoint, page_number = 1) + def perform(publisher_id, url, page_number = 1) # fetch publisher record or raise publisher = Publisher.first!(id: publisher_id) - # prepare a connection for the given url, - # or the publisher endpoint if no url is given - connection = Citygram::Services::ConnectionBuilder.json("request.publisher.#{publisher.id}", url: endpoint) + # prepare a connection for the given url + connection = Citygram::Services::ConnectionBuilder.json("request.publisher.#{publisher.id}", url: url) # execute the request or raise response = connection.get @@ -30,7 +29,7 @@ # queue up a job to retrieve the next page # next_page = response.headers[NEXT_PAGE_HEADER] - if next_page.present? && valid_next_page?(next_page, endpoint) && page_number < MAX_PAGE_NUMBER + if next_page.present? && valid_next_page?(next_page, url) && page_number < MAX_PAGE_NUMBER self.class.perform_async(publisher_id, next_page, page_number + 1) end end
Rename variable and update comments
diff --git a/scripts/update-user-origin.rb b/scripts/update-user-origin.rb index abc1234..def5678 100644 --- a/scripts/update-user-origin.rb +++ b/scripts/update-user-origin.rb @@ -0,0 +1,59 @@+#!/usr/bin/env ruby +require 'json' + +def usage + <<~USAGE + Usage: #{$0} user-guid desired-origin + + e.g. #{$0} 00000000-0000-0000-0000-000000000000 google + + This script requires: + - uaac to be installed + - a valid uaac token + - the uaac target is set up correctly + + Set the UAA target with uaac target: + + > uaac target https://uaa.cloud.service.gov.uk + + You can get a token with the following command + + > uaac token client get admin -s <uaa-admin-token> + + Where <uaa-admin-token> can be retrieved with make prod showenv + USAGE +end + +user_guid, desired_origin = ARGV[0, 2] + +abort usage if desired_origin.nil? || user_guid.nil? +abort usage unless user_guid.match?(/^\h{8}-\h{4}-\h{4}-\h{4}-\h{12}$/) + +resp = `uaac curl '/Users/#{user_guid}' | awk '/RESPONSE BODY/,0'` +user = JSON.parse(resp.lines.map(&:chomp).drop(1).join(' ')) + +puts 'Current user:' +pp user + +user = user.keep_if { |k, _| %w[userName name emails].include?(k) } +user = user.update('origin': desired_origin) + + +command = <<~COMMAND.lines.map(&:chomp).join(' ') + uaac curl '/Users/#{user_guid}' + -X PUT + -H 'If-Match: *' + -H 'Content-Type: application/json' + -H 'Accept: application/json' + -d '#{user.to_json}' +COMMAND + +puts "Updating user: #{user_guid} with origin #{desired_origin}" +puts `#{command}` +abort unless $?.success? + +resp = `uaac curl '/Users/#{user_guid}' | awk '/RESPONSE BODY/,0'` +user = JSON.parse(resp.lines.map(&:chomp).drop(1).join(' ')) + +puts 'Updated user:' +pp user
Add script for updating user origin Signed-off-by: Toby Lorne <527052641d65eef236eeef9545b2acac74c35d57@digital.cabinet-office.gov.uk>
diff --git a/search/organization_search.rb b/search/organization_search.rb index abc1234..def5678 100644 --- a/search/organization_search.rb +++ b/search/organization_search.rb @@ -4,18 +4,6 @@ class OrganizationSearch attr_accessor :start, :limit, :sort, :order, :calc_found_rows, :fields, :filters - - class << self - def client - @client ||= OrganizationClient.new - end - - def find(ids) - ids_array = Array.wrap(ids) - results = client.where(id: ids) - ids_array.length = 1 ? results.first : results - end - end def initialize(start = 0, limit = 10, sort = nil, order = :asc, fields = OrganizationField.all) @start = start @@ -28,7 +16,7 @@ end def add_filter(name, assertion, equals) - @filters << Filter.new(filter_name(name), assertion, filter_value(equals)) + @filters << Filter.new(name, assertion, equals) end def as_json(*args) @@ -46,16 +34,4 @@ def to_json(*) JSON(as_json) end - - private - - def filter_name(name) - OrganizationField::FIELDS[name] - end - - def filter_value(value) - { - - }[value.to_sym] || value - end end
Remove a few useless methods from search class
diff --git a/jsonapi-matchers.gemspec b/jsonapi-matchers.gemspec index abc1234..def5678 100644 --- a/jsonapi-matchers.gemspec +++ b/jsonapi-matchers.gemspec @@ -18,7 +18,7 @@ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] - spec.add_dependency "activesupport", ">= 4.0", "< 6.1" + spec.add_dependency "activesupport", ">= 4.0", "< 7" spec.add_dependency "awesome_print" spec.add_development_dependency "bump", "~> 0.9.0"
Update gemspec to allow for ActiveSupport versions below 7.
diff --git a/knockoutjs-rails.gemspec b/knockoutjs-rails.gemspec index abc1234..def5678 100644 --- a/knockoutjs-rails.gemspec +++ b/knockoutjs-rails.gemspec @@ -13,5 +13,5 @@ s.files = Dir["{lib,vendor}/**/*"] + ["MIT-LICENSE", "README.md"] - s.add_runtime_dependency "railties", "~> 3.1" + s.add_runtime_dependency "railties", [">= 3.1", "< 4.1"] end
Declare support for Rails 4
diff --git a/lib/autodoc/documents.rb b/lib/autodoc/documents.rb index abc1234..def5678 100644 --- a/lib/autodoc/documents.rb +++ b/lib/autodoc/documents.rb @@ -26,6 +26,7 @@ end def write_toc + toc_path.parent.mkpath toc_path.open("w") {|file| file << render_toc } end
Create directory if not exist
diff --git a/lib/merb-simple-forms.rb b/lib/merb-simple-forms.rb index abc1234..def5678 100644 --- a/lib/merb-simple-forms.rb +++ b/lib/merb-simple-forms.rb @@ -10,6 +10,4 @@ Merb::BootLoader.after_app_loads do # code that can be required after the application loads end - - Merb::Plugins.add_rakefiles "merb-simple-forms/merbtasks" end
Remove the rake tasks require
diff --git a/lib/tasks/add_admin.rake b/lib/tasks/add_admin.rake index abc1234..def5678 100644 --- a/lib/tasks/add_admin.rake +++ b/lib/tasks/add_admin.rake @@ -7,6 +7,23 @@ user = User.where("email = ?", email).first user.update_attribute!(:admin, true) - logger.info "#{user.name} has be grunted as admin!!" + logger.info "#{user.name} #{user.email} has be grunted as admin!!" + end + + desc 'Generate default administrator' + task generate: :environment do + logger = Logger.new(File.join(Rails.root, 'log', 'admin.log')) + + user = User.new( + email: 'admin@admin.com', + name: 'admin', + password: '123456', + password_confirmation: '123456', + admin: true + ) + user.save! + + logger.info "Generate administrator successfully, email is #{user.email}, password is 123456" + p "Generate administrator successfully, email is #{user.email}, password is 123456" end end
Add generate administrator rake task. :smiley:
diff --git a/app/models/homepage_header.rb b/app/models/homepage_header.rb index abc1234..def5678 100644 --- a/app/models/homepage_header.rb +++ b/app/models/homepage_header.rb @@ -6,7 +6,7 @@ mount_uploader :background_image, BackgroundImageUploader def self.active - where(active: true).first + find_by(active: true) end def activate
rubocop: Use find_by instead of where.first.
diff --git a/app/models/study_validator.rb b/app/models/study_validator.rb index abc1234..def5678 100644 --- a/app/models/study_validator.rb +++ b/app/models/study_validator.rb @@ -5,14 +5,16 @@ nct_id: 'NCT00734539', columns_or_associated_objects: { outcomes: { count: 24 }, - brief_title: { to_s: 'Fluconazole Prophylaxis for the Prevention of Candidiasis in Infants Less Than 750 Grams Birthweight' } + brief_title: { to_s: 'Fluconazole Prophylaxis for the Prevention of Candidiasis in Infants Less Than 750 Grams Birthweight' }, + study_type: { to_s: 'Interventional' } } }, { nct_id: 'NCT01076361', columns_or_associated_objects: { outcomes: { count: 1 }, - baseline_measures: { count: 13 } + baseline_measures: { count: 13 }, + study_type: { to_s: 'Observational [Patient Registry]' } } } ] @@ -27,8 +29,10 @@ condition[:columns_or_associated_objects].each do |key, value| value.each do |method, expected_result| - if study.send(key).send(method) != expected_result - raise StudyValidatorError + actual_result = study.send(key).send(method) + if actual_result != expected_result + raise StudyValidatorError, "\nExpected: #{expected_result}\nActual: #{actual_result}" + # email people end end
Add better error message when validation fails.
diff --git a/qa/qa/specs/features/browser_ui/1_manage/login/log_into_mattermost_via_gitlab_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/login/log_into_mattermost_via_gitlab_spec.rb index abc1234..def5678 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/login/log_into_mattermost_via_gitlab_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/login/log_into_mattermost_via_gitlab_spec.rb @@ -4,16 +4,14 @@ context 'Manage', :orchestrated, :mattermost do describe 'Mattermost login' do it 'user logs into Mattermost using GitLab OAuth' do - Runtime::Browser.visit(:gitlab, Page::Main::Login) do - Page::Main::Login.act { sign_in_using_credentials } + Runtime::Browser.visit(:gitlab, Page::Main::Login) + Page::Main::Login.perform(&:sign_in_using_credentials) - Runtime::Browser.visit(:mattermost, Page::Mattermost::Login) do - Page::Mattermost::Login.act { sign_in_using_oauth } + Runtime::Browser.visit(:mattermost, Page::Mattermost::Login) + Page::Mattermost::Login.perform(&:sign_in_using_oauth) - Page::Mattermost::Main.perform do |page| - expect(page).to have_content(/(Welcome to: Mattermost|Logout GitLab Mattermost)/) - end - end + Page::Mattermost::Main.perform do |page| + expect(page).to have_content(/(Welcome to: Mattermost|Logout GitLab Mattermost)/) end end end
Remove blocks from Runtime::Browser.visit calls within Mattermost tests Use .perform instead of .act in Mattermost test Signed-off-by: ddavison <2d8af30be2746a8359c9d49236dee9d2380c4fc1@gitlab.com>
diff --git a/lib/aggro/saga_status.rb b/lib/aggro/saga_status.rb index abc1234..def5678 100644 --- a/lib/aggro/saga_status.rb +++ b/lib/aggro/saga_status.rb @@ -2,58 +2,28 @@ # Public: Tracks the state of a saga as it processes. class SagaStatus include Projection + include Concurrent::Obligation - attr_reader :reason - attr_reader :value - - def completed? - %i(failed succeeded).include? state - end - - def fulfilled? - state == :succeeded - end - - def rejected? - state == :failed - end - - def state - states.peek || saga_class.initial - end - - def wait(timeout = nil) - puts timeout + def initialize(id) + @state = :unscheduled + init_obligation + super end events do - def started(state) - puts 'status started' - states << state.to_sym - end - - def transitioned(state) - puts 'status transitioned' - states << state.to_sym + def started + self.state = :pending end def rejected(reason) - states << :failed - @reason = reason - @on_reject.call reason if @on_reject + set_state false, nil, reason + event.set end def resolved(value) - states << :succeeded - @value = value - @on_fulfill.call value if @on_fulfill + set_state true, value, nil + event.set end - end - - private - - def states - @states ||= [] end end end
Use Concurrent::Obligation to manage SagaStatus state.
diff --git a/lib/appsignal/railtie.rb b/lib/appsignal/railtie.rb index abc1234..def5678 100644 --- a/lib/appsignal/railtie.rb +++ b/lib/appsignal/railtie.rb @@ -8,7 +8,12 @@ # Some apps when run from the console do not have Rails.root set, there's # currently no way to spec this. if Rails.root - Appsignal.logger = Logger.new(Rails.root.join('log/appsignal.log')).tap do |l| + if File.writable?('log') + output = Rails.root.join('log/appsignal.log') + else + output = STDOUT + end + Appsignal.logger = Logger.new(output).tap do |l| l.level = Logger::INFO end Appsignal.flush_in_memory_log
Check if log dir is writable
diff --git a/lib/codewars_api/user.rb b/lib/codewars_api/user.rb index abc1234..def5678 100644 --- a/lib/codewars_api/user.rb +++ b/lib/codewars_api/user.rb @@ -1,8 +1,8 @@ module CodewarsApi class User - def initialize(username) - fail 'Username is not set' unless username - @response = RequestHelper.get("#{CodewarsApi::API_URL}/users/#{username}") + def initialize(id_or_username) + fail 'Username or id is not set' unless id_or_username + @response = RequestHelper.get("#{CodewarsApi::API_URL}/users/#{id_or_username}") end def username
Change name of constructor's argument in User
diff --git a/app/decorators/configured_system_decorator.rb b/app/decorators/configured_system_decorator.rb index abc1234..def5678 100644 --- a/app/decorators/configured_system_decorator.rb +++ b/app/decorators/configured_system_decorator.rb @@ -2,4 +2,10 @@ def self.fonticon 'ff ff-configured-system' end + + def single_quad + { + :fonticon => fonticon + } + end end
Add missing single_quad definition for ConfiguredSystemDecorator
diff --git a/spec/adapter/faraday_spec.rb b/spec/adapter/faraday_spec.rb index abc1234..def5678 100644 --- a/spec/adapter/faraday_spec.rb +++ b/spec/adapter/faraday_spec.rb @@ -7,6 +7,9 @@ let(:conn) do Faraday.new(:url => url) do |faraday| + faraday.request :multipart + faraday.request :url_encoded + faraday.adapter(:rack_client) do |builder| builder.use Rack::Lint builder.run Rack::Client::Handler::NetHTTP.new @@ -20,5 +23,30 @@ conn.get('echo').body.should == 'get' end + it 'send url encoded params' do + conn.get('echo', :name => 'zack').body.should == %(get ?{"name"=>"zack"}) + end + + it 'retrieves the response headers' do + response = conn.get('echo') + + response.headers['Content-Type'].should =~ %r{text/plain} + response.headers['content-type'].should =~ %r{text/plain} + end + + it 'handles headers with multiple values' do + conn.get('multi').headers['set-cookie'].should == 'one, two' + end + + it 'with body' do + pending "Faraday tests a GET request with a POST body, which rack-client forbids." + + response = conn.get('echo') do |req| + req.body = {'bodyrock' => true} + end + + response.body.should == %(get {"bodyrock"=>"true"}) + end + end end
Add a weird pending test.
diff --git a/spec/features/config_spec.rb b/spec/features/config_spec.rb index abc1234..def5678 100644 --- a/spec/features/config_spec.rb +++ b/spec/features/config_spec.rb @@ -40,6 +40,11 @@ expect(User.all.count).to equal 1 expect(page).to have_content "Logged in as" end + + it 'can navigate to create new page' do + visit '/admin/pages/new' + expect(page).to have_selector "h1", text: "New Page" + end end end end
Test that navigating to admin/pages/new works This test reproduces #43 Conflicts: spec/features/config_spec.rb
diff --git a/lib/domgen/ruby/model.rb b/lib/domgen/ruby/model.rb index abc1234..def5678 100644 --- a/lib/domgen/ruby/model.rb +++ b/lib/domgen/ruby/model.rb @@ -13,7 +13,7 @@ # module Domgen - FacetManager.facet(:ruby) do |facet| + FacetManager.facet(:ruby => [:application]) do |facet| facet.enhance(DataModule) do attr_writer :module_name
Make sure ruby facet depends on application facet
diff --git a/week-4/count-between/my_solution.rb b/week-4/count-between/my_solution.rb index abc1234..def5678 100644 --- a/week-4/count-between/my_solution.rb +++ b/week-4/count-between/my_solution.rb @@ -16,9 +16,10 @@ def count_between(list_of_integers, lower_bound, upper_bound) btwn = 0 - if list_of_integers.each do |n| - n >= lower_bound && n >= upper_bound + list_of_integers.each do |n| + if n >= lower_bound && n <= upper_bound btwn += 1 + end end btwn end
Add count between challenge. :q wq x q subl .
diff --git a/lib/discordrb.rb b/lib/discordrb.rb index abc1234..def5678 100644 --- a/lib/discordrb.rb +++ b/lib/discordrb.rb @@ -1,4 +1,11 @@ # frozen_string_literal: true + +unless ENV['DISCORDRB_V2_MESSAGE'] + puts "You're using version 2 of discordrb which has some breaking changes!" + puts "Don't worry if your bot crashes, you can find a list and migration advice here:" + puts ' https://github.com/meew0/discordrb/blob/master/CHANGELOG.md#200' + puts 'This message will go away in version 2.1 or can be disabled by setting the DISCORDRB_V2_MESSAGE environment variable.' +end require 'discordrb/version' require 'discordrb/bot'
Add a message that version 2 is being used to the standard output (don't want to break people's stuff without them knowing)
diff --git a/classes/cocoadocs_settings.rb b/classes/cocoadocs_settings.rb index abc1234..def5678 100644 --- a/classes/cocoadocs_settings.rb +++ b/classes/cocoadocs_settings.rb @@ -2,8 +2,9 @@ def self.settings_at_location download_location cocoadocs_settings = download_location + "/.cocoadocs.yml" + cocoadocs_settings = download_location + "/.cocoapods.yml" unless File.exist? cocoadocs_settings + settings = YAML.load(File.read(Dir.pwd + "/views/cocoadocs.defaults.yml")) - if File.exist? cocoadocs_settings vputs "- found custom CocoaDocs settings"
Add support for .cocoapods.yml files as well as cocoadocs.yml settings
diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index abc1234..def5678 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -1,7 +1,7 @@ class SearchController < ApplicationController def index if params[:q] - redirect_to search_path(URI.escape(params[:q].strip)) + redirect_to search_path(params[:q].strip) elsif params[:term].present? @term = params[:term].strip puts "hi #{@term}"
Fix another, almost identical, search bug
diff --git a/lib/pilfer/middleware.rb b/lib/pilfer/middleware.rb index abc1234..def5678 100644 --- a/lib/pilfer/middleware.rb +++ b/lib/pilfer/middleware.rb @@ -30,7 +30,7 @@ end def default_profiler - reporter = Pilfer::Logger.new($stdout, :app_root => ENV['PWD']) + reporter = Pilfer::Logger.new($stdout) Pilfer::Profiler.new(reporter) end
Remove default value for app_root If PWD is going to be used as the default app root, it should be defined in the reporters. This implementation only worked when using the middleware and its default logger.
diff --git a/lib/projectionist/cli.rb b/lib/projectionist/cli.rb index abc1234..def5678 100644 --- a/lib/projectionist/cli.rb +++ b/lib/projectionist/cli.rb @@ -16,7 +16,7 @@ desc 'edit <type> <file>', 'Edit the file for <type> named <file>' option :editor def edit(type, file) - editor = options[:editor] || ENV['EDITOR'] || `which vim` + editor = options[:editor] || ENV['VISUAL'] || ENV['EDITOR'] || `which vim` file = @projections.file_for type, file exec editor, file end
Check for $VISUAL before $EDITOR
diff --git a/app/models/concerns/tasting_enums.rb b/app/models/concerns/tasting_enums.rb index abc1234..def5678 100644 --- a/app/models/concerns/tasting_enums.rb +++ b/app/models/concerns/tasting_enums.rb @@ -0,0 +1,40 @@+module TastingEnums + extend ActiveSupport::Concern + + RED_FRUIT_ENUMS = { red: 1, + blue: 2, + black: 3} + WHITE_FRUIT_ENUMS = { citrus: 1, + apple_pear: 2, + stone: 3, + tropical: 4} + FRUIT_CONDITION_ENUMS = { tart: 1, + under_ripe: 2, + ripe: 3, + over_ripe: 4, + jammy: 5 } + CLIMATE_ENUMS = { cool: 1, + warm: 2} + COUNTRY_ENUMS = { france: 1, + italy: 2, + united_states: 3, + australia: 4, + argentina: 5, + germany: 6, + new_zealand: 7 } + RED_GRAPE_ENUMS = { gamay: 1, + cabernet_sauvignon: 2, + merlot: 3, + malbec: 4, + syrah_shiraz: 5, + pinot_noir: 6, + sangiovese: 7, + nebbiolo: 8, + zinfandel: 9 } + WHITE_GRAPE_ENUMS = { chardonnay: 1, + sauvignon_blanc: 2, + riesling: 3, + chenin_blanc: 4, + viognier: 5, + pinot_grigio: 6 } +end
Make module for enum constants
diff --git a/lib/radbeacon/scanner.rb b/lib/radbeacon/scanner.rb index abc1234..def5678 100644 --- a/lib/radbeacon/scanner.rb +++ b/lib/radbeacon/scanner.rb @@ -16,6 +16,15 @@ radbeacons end + def fetch(mac_address) + radbeacon = nil + dev = BluetoothLeDevice.new(mac_address, nil) + if dev.fetch_characteristics + radbeacon = radbeacon_check(dev) + end + radbeacon + end + def radbeacon_check(device) radbeacon = nil case device.values[C_DEVICE_NAME]
Add fetch method to return a radbeacon with a given mac
diff --git a/app/services/file_storage_service.rb b/app/services/file_storage_service.rb index abc1234..def5678 100644 --- a/app/services/file_storage_service.rb +++ b/app/services/file_storage_service.rb @@ -16,4 +16,29 @@ S3_BUCKET end + def self.create_and_upload_public_object(filename, body) + key = object_key(filename) + obj = get_bucket.object(key) + url = URI.parse(obj.presigned_url(:put, acl: 'public-read')) + + Net::HTTP.start(url.host) do |http| + http.send_request("PUT", url.request_uri, body, { + # This is required, or Net::HTTP will add a default unsigned content-type. + "content-type" => "", + }) + end + obj + end + + def self.create_and_upload_private_object(filename, body) + key = object_key(filename) + obj = S3_BUCKET.object(key) + obj.put(body: body) + obj + end + + def self.object_key(filename) + "uploads/#{SecureRandom.uuid}/#{filename}" + end + end
Add methods for public and private adding
diff --git a/lib/tasks/downloads.rake b/lib/tasks/downloads.rake index abc1234..def5678 100644 --- a/lib/tasks/downloads.rake +++ b/lib/tasks/downloads.rake @@ -11,8 +11,9 @@ sheet.update_row 0, *package_attributes.map(&:to_s).map(&:titleize), 'Category' package_list = Package + .exclude_unregistered_packages .active_batch_scope - .exclude_unregistered_packages + .order(:name) .select(package_attributes) package_list.each_with_index do |package, index|
Sort packages in spreadsheet by name
diff --git a/lib/fog/google/examples/create.rb b/lib/fog/google/examples/create.rb index abc1234..def5678 100644 --- a/lib/fog/google/examples/create.rb +++ b/lib/fog/google/examples/create.rb @@ -9,6 +9,7 @@ :private_key_path => File.expand_path("~/.ssh/id_rsa"), :public_key_path => File.expand_path("~/.ssh/id_rsa.pub"), :user => ENV['USER'], + :tags => ["fog"] }) # My own wait_for because it hides errors
[google] Add support for instance tags
diff --git a/test/schema.rb b/test/schema.rb index abc1234..def5678 100644 --- a/test/schema.rb +++ b/test/schema.rb @@ -1,31 +1,30 @@ ActiveRecord::Schema.define(:version => 1) do + create_table "articles", :force => true do |t| + t.column "headline", "string", null: false + t.column "section", "string" + t.column "slug", "string", null: false + t.column "type", "string" + t.index ["slug"], name: "index_articles_on_slug", unique: true + end - create_table "articles", :force => true do |t| - t.column "headline", "string" - t.column "section", "string" - t.column "slug", "string" - t.column "type", "string" - end - create_table "people", :force => true do |t| t.column "name", "string" t.column "web_slug", "string" end - + create_table "companies", :force => true do |t| t.column "name", "string" t.column "slug", "string" end - + create_table "posts", :force => true do |t| t.column "headline", "string" t.column "slug", "string" end - + create_table "events", :force => true do |t| t.column "title", "string" t.column "location", "string" t.column "slug", "string" end - -end+end
Test with not-null constraint and index
diff --git a/lib/http_client/jruby/response.rb b/lib/http_client/jruby/response.rb index abc1234..def5678 100644 --- a/lib/http_client/jruby/response.rb +++ b/lib/http_client/jruby/response.rb @@ -30,7 +30,11 @@ end def to_hash - Hash[ @native_response.get_all_headers.map{ |h| [h.get_name, h.get_value] } ] + hash = {} + each do |name, value| + hash[name] = hash[name] ? hash[name] + ", #{value}" : value + end + hash end def each
Support multiple values for one header
diff --git a/activestorage/db/update_migrate/20191206030411_create_active_storage_variant_records.rb b/activestorage/db/update_migrate/20191206030411_create_active_storage_variant_records.rb index abc1234..def5678 100644 --- a/activestorage/db/update_migrate/20191206030411_create_active_storage_variant_records.rb +++ b/activestorage/db/update_migrate/20191206030411_create_active_storage_variant_records.rb @@ -1,7 +1,7 @@ class CreateActiveStorageVariantRecords < ActiveRecord::Migration[6.0] def change # Use Active Record's configured type for primary key - create_table :active_storage_variant_records, id: primary_key_type do |t| + create_table :active_storage_variant_records, id: primary_key_type, if_not_exists: true do |t| t.belongs_to :blob, null: false, index: false, type: blobs_primary_key_type t.string :variation_digest, null: false
Make ActiveStorage update migration compatible with install migration If you install active_storage in rails 6.1, then use rails app:update, the service name migration handles that case but not the variant records one, which fails trying to re-create the table. Co-authored-by: Adrianna Chang <56e0e0ecf2f5a1ed63a3361922ae89343804687c@shopify.com>
diff --git a/app/views/DELETE.xml.builder b/app/views/DELETE.xml.builder index abc1234..def5678 100644 --- a/app/views/DELETE.xml.builder +++ b/app/views/DELETE.xml.builder @@ -0,0 +1,24 @@+################################################################################ +#This file is part of Dedomenon. +# +#Dedomenon is free software: you can redistribute it and/or modify +#it under the terms of the GNU Affero General Public License as published by +#the Free Software Foundation, either version 3 of the License, or +#(at your option) any later version. +# +#Dedomenon is distributed in the hope that it will be useful, +#but WITHOUT ANY WARRANTY; without even the implied warranty of +#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +#GNU Affero General Public License for more details. +# +#You should have received a copy of the GNU Affero General Public License +#along with Dedomenon. If not, see <http://www.gnu.org/licenses/>. +# +#Copyright 2008 Raphaël Bauduin +################################################################################ + +# *Description* +# Standard XML template for rendering DELETE responses. +# Yet not clear what to be rendered. +xml.instruct! :xml, :version=>"1.0", :encoding=>"UTF-8" +xml.status "deleted"
DELETE view is complete for now. We only return ok
diff --git a/lib/metric_fu.rb b/lib/metric_fu.rb index abc1234..def5678 100644 --- a/lib/metric_fu.rb +++ b/lib/metric_fu.rb @@ -3,7 +3,7 @@ RAILS = File.exist?("config/environment.rb") if RAILS - MetricFu::CODE_DIRS = ['app'] + MetricFu::CODE_DIRS = ['app', 'lib'] else MetricFu::CODE_DIRS = ['lib'] end
Include both app and lib in rails apps
diff --git a/lib/linkage/comparators/within.rb b/lib/linkage/comparators/within.rb index abc1234..def5678 100644 --- a/lib/linkage/comparators/within.rb +++ b/lib/linkage/comparators/within.rb @@ -1,5 +1,20 @@ module Linkage module Comparators + # Within is a integer comparator. It checks if two values are within a + # specified range. Score is either 0 to 1. + # + # To use Within, you must specify one field for each record to use in + # the comparison, along with a range value. + # + # Consider the following example, using a {Configuration} as part of + # {Dataset#link_with}: + # + # ```ruby + # config.within(:foo, :bar, 5) + # ``` + # + # For each pair of records, if value of `foo` is within 5 (inclusive) of + # the value of `bar`, the score is 1. Otherwise, the score is 0. class Within < Comparator def initialize(field_1, field_2, value) if field_1.ruby_type != field_2.ruby_type
Add documentation for Within comparator
diff --git a/lib/processors/route_processor.rb b/lib/processors/route_processor.rb index abc1234..def5678 100644 --- a/lib/processors/route_processor.rb +++ b/lib/processors/route_processor.rb @@ -0,0 +1,11 @@+require 'processors/base_processor' +require 'processors/alias_processor' +require 'lib/processors/lib/route_helper' +require 'util' +require 'set' + +if OPTIONS[:rails3] + require 'lib/processors/rails3_route_processor' +else + require 'lib/processors/rails2_route_processor' +end
Switch route processor based on Rails version
diff --git a/Casks/blu-ray-player.rb b/Casks/blu-ray-player.rb index abc1234..def5678 100644 --- a/Casks/blu-ray-player.rb +++ b/Casks/blu-ray-player.rb @@ -1,6 +1,6 @@ class BluRayPlayer < Cask - version '2.10.2' - sha256 '23105d6b8703b9ded387ba13b09d7e1b50d5bbb563fd91a7492a7ee7fd0de2bf' + version '2.10.4' + sha256 '76e9731115b3305ba21f5c451f90d2123fd357defca8206a496a8f9b63480cc1' url 'http://www.macblurayplayer.com/user/download/Mac_Bluray_Player.dmg' homepage 'http://www.macblurayplayer.com/'
Upgrade Blu-ray Player.app to v2.10.4
diff --git a/Casks/radiant-player.rb b/Casks/radiant-player.rb index abc1234..def5678 100644 --- a/Casks/radiant-player.rb +++ b/Casks/radiant-player.rb @@ -1,7 +1,7 @@ class RadiantPlayer < Cask - url 'https://github.com/kbhomes/google-music-mac/releases/download/v1.2.0/Radiant.Player.zip' + url 'https://github.com/kbhomes/google-music-mac/releases/download/v1.2.1/Radiant.Player.zip' homepage 'http://kbhomes.github.io/google-music-mac/' - version '1.2.0' - sha256 '7a9a0d7b1a17cee599012f216cc285bcabe6a1005ddb87d531e7a44875a67131' + version '1.2.1' + sha256 'dc1ed98170e05c430779f527191717cb412e74f398324878286df4a2bbad79d4' link 'Radiant Player.app' end
Upgrade radiant player to v1.2.1
diff --git a/config/initializers/sentry.rb b/config/initializers/sentry.rb index abc1234..def5678 100644 --- a/config/initializers/sentry.rb +++ b/config/initializers/sentry.rb @@ -7,5 +7,33 @@ # Set tracesSampleRate to 1.0 to capture 100% # of transactions for performance monitoring. # We recommend adjusting this value in production - config.traces_sample_rate = 0.01 + config.traces_sampler = lambda do |sampling_context| + # if this is the continuation of a trace, just use that decision (rate controlled by the caller) + unless sampling_context[:parent_sampled].nil? + next sampling_context[:parent_sampled] + end + + # transaction_context is the transaction object in hash form + # keep in mind that sampling happens right after the transaction is initialized + # for example, at the beginning of the request + transaction_context = sampling_context[:transaction_context] + + # transaction_context helps you sample transactions with more sophistication + # for example, you can provide different sample rates based on the operation or name + op = transaction_context[:op] + transaction_name = transaction_context[:name] + + case op + when /request/ + # for Rails applications, transaction_name would be the request's path (env["PATH_INFO"]) instead of "Controller#action" + case transaction_name + when '/', '/ping' + 0.00 # ignore health check + else + 0.05 + end + else + 0.0 # ignore all other transactions + end + end end
Update Sentry to ignore health check transactions
diff --git a/lib/taverna_player/model_proxy.rb b/lib/taverna_player/model_proxy.rb index abc1234..def5678 100644 --- a/lib/taverna_player/model_proxy.rb +++ b/lib/taverna_player/model_proxy.rb @@ -3,7 +3,7 @@ class ModelProxy attr_reader :class_name - def initialize(class_name, method_names) + def initialize(class_name, method_names = []) if class_name.is_a?(String) begin @class_name = Object.const_get(class_name)
Allow a model proxy to not proxy any methods. Initializer now defaults to an empty list for the method proxy list.
diff --git a/lib/grat/system.rb b/lib/grat/system.rb index abc1234..def5678 100644 --- a/lib/grat/system.rb +++ b/lib/grat/system.rb @@ -26,6 +26,7 @@ if params[:template] template = model.find_by_url params[:template] if template + content.template_url = template.url content.suggested_fields = template.default_content_vars.keys end end
Correct default template on new content.
diff --git a/lib/twitter/api/spam_reporting.rb b/lib/twitter/api/spam_reporting.rb index abc1234..def5678 100644 --- a/lib/twitter/api/spam_reporting.rb +++ b/lib/twitter/api/spam_reporting.rb @@ -8,7 +8,7 @@ # The users specified are blocked by the authenticated user and reported as spammers # - # @see https://dev.twitter.com/docs/api/1.1/post/report_spam + # @see https://dev.twitter.com/docs/api/1.1/post/users/report_spam # @rate_limited Yes # @authentication_required Requires user context # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
Update documentation URL for POST users/report_spam https://dev.twitter.com/issues/698
diff --git a/process_shared.gemspec b/process_shared.gemspec index abc1234..def5678 100644 --- a/process_shared.gemspec +++ b/process_shared.gemspec @@ -14,7 +14,7 @@ s.add_dependency('ffi', '~> 1.0') - s.add_development_dependency('ci_reporter_minitest') + s.add_development_dependency('ci_reporter_minitest', '~> 1.0') s.add_development_dependency('flog') s.add_development_dependency('minitest') s.add_development_dependency('minitest-matchers')
Add version range for ci_reporter_minitest.
diff --git a/lib/kindle/note.rb b/lib/kindle/note.rb index abc1234..def5678 100644 --- a/lib/kindle/note.rb +++ b/lib/kindle/note.rb @@ -15,7 +15,8 @@ title_author, highlight, *notes = *raw_note.split("\r\n") note = Note.new - location = highlight.match(/loc. (\d*)/i) + location = highlight.match(/loc. (\d*)/i) # Kindle 2nd Gen + location ||= highlight.match(/Location (\d*)/i) # Kindle 4th Gen (touch) note.location = location[1].to_i if location # "Added on Wednesday, June 30, 2010, 10:35 PM"
Support the 4th gen kindle location format
diff --git a/lib/spreewald.rb b/lib/spreewald.rb index abc1234..def5678 100644 --- a/lib/spreewald.rb +++ b/lib/spreewald.rb @@ -1,7 +1,6 @@ # coding: UTF-8 require 'cucumber_priority' -require "spreewald_support/field_errors" require "spreewald_support/version" require "spreewald_support/github" require "spreewald_support/unsupported_email_header"
Fix "undefined method `build_rb_world_factory` for nil:NilClass" error when running tests on a real project
diff --git a/lib/poke/camera.rb b/lib/poke/camera.rb index abc1234..def5678 100644 --- a/lib/poke/camera.rb +++ b/lib/poke/camera.rb @@ -14,6 +14,8 @@ # # Returns a Camera object. def initialize(params = {}) + @player = params[:player] + @x, @y = 0 end end
Add player, x, and y ivars
diff --git a/lib/tasks/git.rake b/lib/tasks/git.rake index abc1234..def5678 100644 --- a/lib/tasks/git.rake +++ b/lib/tasks/git.rake @@ -0,0 +1,61 @@+namespace :git do + require 'fileutils' + + IGNORE_REPOS = [ + "origin", + "upstream", + ] + + TEAM_REPOS = { + 'donthorp' => 'git@github.com:donthorp/kandan.git', + 'gabceb' => 'git://github.com/gabceb/kandan-1.git', + 'fusion94' => 'git://github.com/fusion94/kandan.git', + 'SpencerCooley' => 'git://github.com/SpencerCooley/kandan.git', + 'jrgifford' => 'git://github.com/jrgifford/kandan.git', + } + + def get_remotes + remotes = [] + o = `git remote`.split("\n") + o.each() do |r| + next if IGNORE_REPOS.include?(r) + remotes << r + end + + return remotes + end + + def get_user + `git config --get github.user`.chop() + end + + def get_team_repos + repos = TEAM_REPOS + repos.delete(get_user()) + return repos + end + + desc "Add team upstream repos" + task :add_team_repos do + + remotes = get_remotes() + + get_team_repos().each() do |k,v| + if remotes.include?(k) + puts "Skipping remote for #{k}. Already added." + next + end + + sh %{git remote add #{k} #{v}} + end + end + + desc "Prune removed branches from remotes" + task :prune_team_repos do + repos = get_team_repos() + + repos.each() do |k,v| + sh %{git remote prune #{k}} + end + end +end
Add add_team_repos and prune_team_repos tasks to assist in PR handling
diff --git a/lib/wptemplates.rb b/lib/wptemplates.rb index abc1234..def5678 100644 --- a/lib/wptemplates.rb +++ b/lib/wptemplates.rb @@ -1,14 +1,20 @@ require "wptemplates/version" require "wptemplates/parser" +require "wptemplates/preprocessor" module Wptemplates def self.parse text parser.parse(text) + parser.parse(preprocessor.preprocess(text)) end def self.parser @parser ||= Parser.new end + def self.preprocessor + @preprocessor ||= Preprocessor.new + end + end
Use the preprocessor for default parse
diff --git a/liquid-c.gemspec b/liquid-c.gemspec index abc1234..def5678 100644 --- a/liquid-c.gemspec +++ b/liquid-c.gemspec @@ -23,5 +23,6 @@ spec.add_development_dependency "bundler", "~> 1.5" spec.add_development_dependency "rake" spec.add_development_dependency 'rake-compiler' + spec.add_development_dependency 'minitest' spec.add_development_dependency 'stackprof' if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.1.0") end
Add direct dependency on minitest
diff --git a/libraries/sensu.rb b/libraries/sensu.rb index abc1234..def5678 100644 --- a/libraries/sensu.rb +++ b/libraries/sensu.rb @@ -18,22 +18,27 @@ %w(id chef_type data_bag).include?(key) } ) - config = hash_sorter( + config = Chef::Mixin::DeepMerge.merge( Chef::Mixin::DeepMerge.merge( - Chef::Mixin::DeepMerge.merge( - node_config, client_config - ), - databag_config - ) + node_config, client_config + ), + databag_config ) - JSON.pretty_generate(config) + JSON.pretty_generate(sort_hash(config)) end - def self.hash_sorter(hash) + def self.sort_hash(hash) if(hash.is_a?(Hash)) new_hash = defined?(OrderedHash) ? OrderedHash.new : Hash.new hash.keys.sort.each do |key| - new_hash[key] = hash[key].is_a?(Hash) ? hash_sorter(hash[key]) : hash[key] + new_hash[key] = case hash[key] + when Mash + sort_hash(hash[key].to_hash) + when Hash + sort_hash(hash[key]) + else + hash[key] + end end new_hash else
Rename sorting method. Force Mash instances into Hash.
diff --git a/spec/dummy_4/config/routes.rb b/spec/dummy_4/config/routes.rb index abc1234..def5678 100644 --- a/spec/dummy_4/config/routes.rb +++ b/spec/dummy_4/config/routes.rb @@ -2,6 +2,7 @@ get "/users/:user_id/render_elsewhere(.:format)", :to => "likes#render_elsewhere" get "/users/:user_id/send_instructions", :to => "users#send_instructions" get "/users/noaction", :to => "users#noaction" + get "/users/export/:id", :to => "users#export" resources :users do resources :likes end
Add missing route to Rails 4 test dummy
diff --git a/spec/features/tickets_spec.rb b/spec/features/tickets_spec.rb index abc1234..def5678 100644 --- a/spec/features/tickets_spec.rb +++ b/spec/features/tickets_spec.rb @@ -0,0 +1,33 @@+# frozen_string_literal: true + +require 'rails_helper' + +describe 'ticket system', type: :feature, js: true do + let(:course) { create(:course) } + let(:admin) { create(:admin, email: 'spec@wikiedu.org') } + + before do + login_as admin + stub_token_request + create(:courses_user, course: course, user: admin, + role: CoursesUsers::Roles::WIKI_ED_STAFF_ROLE) + end + + it 'creates a ticket from a help request and lets an admin reply' do + visit "/courses/#{course.slug}" + click_button 'Get Help' + click_link 'question about editing Wikipedia' + fill_in 'message', with: 'I need some help with adding a photo to my article.' + click_button 'Send' + click_link 'Ok' + click_link 'Admin' + click_link 'Open Tickets: 1' + click_link 'Show' + within('form.tickets-reply') do + find('.mce-content-body').click + find('.mce-content-body').send_keys('Please review this training module.') + end + click_button 'Send Reply' + expect(page).to have_content 'Ticket is currently Awaiting Response' + end +end
Add basic browser test for Get Help request and ticket system
diff --git a/bump_dependencies_for_repo.rb b/bump_dependencies_for_repo.rb index abc1234..def5678 100644 --- a/bump_dependencies_for_repo.rb +++ b/bump_dependencies_for_repo.rb @@ -1,12 +1,32 @@ #!/usr/bin/env ruby require "./app/workers/dependency_file_fetcher" +require "./lib/github" require "highline/import" require "dotenv" Dotenv.load -repo = ask "Which repo would you like to bump dependencies for? " -language = ask "Which language? " +repo = ask("Which repo would you like to bump dependencies for? ") do |question| + question.validate = lambda { |repo_name| + begin + Github.client.repository(repo_name) + true + rescue Octokit::NotFound + false + end + } + + question.responses[:invalid_type] = + "Could not access that repo. Make sure you use the format "\ + "'gocardless/bump', and that your GitHub token has read/write "\ + "access to the given repo." +end + +language = choose do |menu| + menu.index = :none + menu.header = "Which language would you like to bump dependencies for?" + menu.choices(:ruby, :node) +end Workers::DependencyFileFetcher. perform_async("repo" => { "language" => language, "name" => repo })
Make user entry script foolproof
diff --git a/config/environments/production.rb b/config/environments/production.rb index abc1234..def5678 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -17,8 +17,10 @@ config.log_level = :warn - config.cache_store = :dalli_store, { - metastore: "memcached://#{ENV['MEMCACHE_SERVERS']}/meta", - entitystore: "memcached://#{ENV['MEMCACHE_SERVERS']}/body" - } + config.cache_store = :dalli_store, + ENV["MEMCACHIER_SERVERS"].split(","), + { + :username => ENV["MEMCACHIER_USERNAME"], + :password => ENV["MEMCACHIER_PASSWORD"] + } end
Switch to Memcachier for memcache
diff --git a/app/cells/post_player_cell.rb b/app/cells/post_player_cell.rb index abc1234..def5678 100644 --- a/app/cells/post_player_cell.rb +++ b/app/cells/post_player_cell.rb @@ -11,6 +11,6 @@ bgcol = 'ffffff' linkcol = 'e99708' - "http://bandcamp.com/EmbeddedPlayer/album=#{album_id}/size=#{size}/bgcol=#{bgcol}/linkcol=#{linkcol}/transparent=true/" + "https://bandcamp.com/EmbeddedPlayer/album=#{album_id}/size=#{size}/bgcol=#{bgcol}/linkcol=#{linkcol}/transparent=true/" end end
Move bandcamp player iframe to https
diff --git a/app/mailers/contact_mailer.rb b/app/mailers/contact_mailer.rb index abc1234..def5678 100644 --- a/app/mailers/contact_mailer.rb +++ b/app/mailers/contact_mailer.rb @@ -1,5 +1,8 @@ class ContactMailer < ActionMailer::Base default from: "Website Submission Form <webmail@tortugas-llc.com>" + ActionMailer::Base.smtp_settings = { + :openssl_verify_mode => 'none' + } def contact_us_email(options) @name = options[:name]
Fix OpenSSL hostname mismatch issue with mailer
diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index abc1234..def5678 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -21,6 +21,9 @@ edit_sample.js edit_study_subject.js enrolls.js + jquery.2.0.0.min.js + jquery-ui.1.10.3.min.js + jquery-ui.1.10.1.css jquery-ui-timepicker-addon.js jquery.simplemodal.1.4.4.min.js new_address.js @@ -30,6 +33,5 @@ menus.css.scss scaffold.css simple_modal_basic.css - sunspot.css sunspot.js )
Include jquery files in precompile list.
diff --git a/config/software/berkshelf2.rb b/config/software/berkshelf2.rb index abc1234..def5678 100644 --- a/config/software/berkshelf2.rb +++ b/config/software/berkshelf2.rb @@ -15,7 +15,7 @@ # limitations under the License. # -log.deprecated('berkshelf2') { 'Please upgrade to Berkshelf 3. Continued use of Berkshelf 2 will not be supported in the future.' } +Omnibus.logger.deprecated('berkshelf2') { 'Please upgrade to Berkshelf 3. Continued use of Berkshelf 2 will not be supported in the future.' } name "berkshelf2" default_version "2.0.17"
Use the correct logger object
diff --git a/spec/api/header_spec.rb b/spec/api/header_spec.rb index abc1234..def5678 100644 --- a/spec/api/header_spec.rb +++ b/spec/api/header_spec.rb @@ -0,0 +1,32 @@+# -*- coding: utf-8 -*- +# +# Author:: Douglas Triggs (<doug@getchef.com>) +# Copyright:: Copyright (c) 2014 Chef, Inc. + +describe "Headers" do + let (:request_url) { api_url("users") } + let (:requestor) { platform.admin_user } + + context "Request Headers" do + + # Right, now, we're just checking header versions, this can also be a template + # for future header tests if we need to test anything else. + + # TODO: add some more digits when Chef Client reaches version 999 + # I may be retired by then. + let (:high_version_headers) { {"X-Chef-Version" => "999.0.0" } } + let (:low_version_headers) { {"X-Chef-Version" => "9.0.1" } } + + it "Accepts High Version" do + get(request_url, requestor, :headers => high_version_headers).should look_like({ + :status => 200 + }) + end + + it "Rejects Low Version" do + get(request_url, requestor, :headers => low_version_headers).should look_like({ + :status => 400 + }) + end + end # context "Request Headers" +end # describe "Headers"
Add header tests to check for min/max (or lack of max) client version
diff --git a/lib/bugsnag/middleware/rack_request.rb b/lib/bugsnag/middleware/rack_request.rb index abc1234..def5678 100644 --- a/lib/bugsnag/middleware/rack_request.rb +++ b/lib/bugsnag/middleware/rack_request.rb @@ -29,6 +29,7 @@ :httpMethod => request.request_method, :params => params.to_hash, :userAgent => request.user_agent, + :referer => request.referer, :clientIp => request.ip })
Add HTTP referer to the request tab
diff --git a/recipes/default.rb b/recipes/default.rb index abc1234..def5678 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -4,6 +4,7 @@ description "DataStax Repo for Apache Cassandra" url "http://rpm.datastax.com/community" gpgcheck false + metadata_expire "1" sslverify false action :create end
Set metdata_expire to 1 second so yum updates quickly
diff --git a/recipes/default.rb b/recipes/default.rb index abc1234..def5678 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -21,9 +21,7 @@ when 'windows' include_recipe 'perl::_windows' else - node['perl']['packages'].each do |perl_pkg| - package perl_pkg - end + package perl_pkg node['perl']['packages'] cpanm = node['perl']['cpanm'].to_hash
Use multi-package to speed up installs Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
diff --git a/recipes/default.rb b/recipes/default.rb index abc1234..def5678 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -29,6 +29,7 @@ chef_gem 'fog' do version node['dnsimple']['fog_version'] + compile_time false if Chef::Resource::ChefGem.method_defined?(:compile_time) action :install end
Resolve the compile_time warnings for Chef 12.1+
diff --git a/recipes/package.rb b/recipes/package.rb index abc1234..def5678 100644 --- a/recipes/package.rb +++ b/recipes/package.rb @@ -3,7 +3,7 @@ # Cookbook:: transmission # Recipe:: package # -# Copyright:: 2011-2016, Chef Software, Inc. +# Copyright:: 2011-2017, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -18,11 +18,6 @@ # limitations under the License. # -case node['platform_family'] -when 'debian', 'ubuntu' - package %w(transmission transmission-cli transmission-daemon) -else - package %w(transmission transmission-cli transmission-daemon) -end +package %w(transmission transmission-cli transmission-daemon) include_recipe 'transmission::default'
Remove a case statement for no reason Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
diff --git a/quantity-queries.gemspec b/quantity-queries.gemspec index abc1234..def5678 100644 --- a/quantity-queries.gemspec +++ b/quantity-queries.gemspec @@ -35,5 +35,5 @@ # Gems Dependencies s.add_dependency("sass", ["~> 3.4"]) - s.add_dependency("compass", ["~> 1.0.0"]) + s.add_dependency("compass", ["~> 1.0"]) end
Fix pessimistic dependency on Compass
diff --git a/lib/activerecord-refresh_connection/active_record/connection_adapters/refresh_connection_management.rb b/lib/activerecord-refresh_connection/active_record/connection_adapters/refresh_connection_management.rb index abc1234..def5678 100644 --- a/lib/activerecord-refresh_connection/active_record/connection_adapters/refresh_connection_management.rb +++ b/lib/activerecord-refresh_connection/active_record/connection_adapters/refresh_connection_management.rb @@ -16,22 +16,28 @@ response = @app.call(env) - clear_connections = should_clear_connections? && !testing - response[2] = ::Rack::BodyProxy.new(response[2]) do # disconnect all connections on the connection pool - ActiveRecord::Base.clear_all_connections! if clear_connections + clear_connections unless testing end response rescue Exception - ActiveRecord::Base.clear_all_connections! if clear_connections + clear_connections unless testing raise end private - def should_clear_connections? + def clear_connections + if should_clear_all_connections? + ActiveRecord::Base.clear_all_connections! + else + ActiveRecord::Base.clear_active_connections! + end + end + + def should_clear_all_connections? return true if max_requests <= 1 @mutex.synchronize do
Call clear_active_connections! or clear_all_connections! always!
diff --git a/core/spec/support/refinery.rb b/core/spec/support/refinery.rb index abc1234..def5678 100644 --- a/core/spec/support/refinery.rb +++ b/core/spec/support/refinery.rb @@ -8,8 +8,8 @@ # set some config values so that image and resource factories don't fail to create config.before do - Refinery::Images.max_image_size = 5242880 - Refinery::Resources.max_file_size = 52428800 + Refinery::Images.max_image_size = 5242880 if defined?(Refinery::Images) + Refinery::Resources.max_file_size = 52428800 if defined?(Refinery::Resources) end config.after do
Fix for when we don't have constants defined.
diff --git a/webapp/add_user.rb b/webapp/add_user.rb index abc1234..def5678 100644 --- a/webapp/add_user.rb +++ b/webapp/add_user.rb @@ -0,0 +1,31 @@+#!/usr/bin/env ruby + +require "highline" +require "bcrypt" +require "yaml" + +cli = HighLine.new + +user = cli.ask("Username?") +pass = cli.ask("Password?") { |c| c.echo = false } + +puts "Adding user '#{user}'" + +begin + hashed_password = BCrypt::Password.create(pass) + + password_hashes = if File.exist?("passwords") + YAML.safe_load(File.read("passwords")) + else + {} + end + + password_hashes[user] = hashed_password.to_s + + File.open("passwords", "w") do |file| + file.write password_hashes.to_yaml + end + + puts "... done" +end +
Add script to add users.
diff --git a/lib/devise_security_extension/rails.rb b/lib/devise_security_extension/rails.rb index abc1234..def5678 100644 --- a/lib/devise_security_extension/rails.rb +++ b/lib/devise_security_extension/rails.rb @@ -1,3 +1,5 @@+require "active_support" + module DeviseSecurityExtension class Engine < ::Rails::Engine ActiveSupport.on_load(:action_controller) do
Fix an issue with CI run where 'active_support' isn't loaded.
diff --git a/feed_duck.gemspec b/feed_duck.gemspec index abc1234..def5678 100644 --- a/feed_duck.gemspec +++ b/feed_duck.gemspec @@ -11,7 +11,7 @@ spec.summary = %q{This gem parses RSS and Atom feeds into Ruby objects.} spec.description = %q{This gem parses RSS and Atom feeds and provides an uniform ruby-object interface to access data from both feed standards.} - spec.homepage = "" + spec.homepage = "https://github.com/abernardes/feed_duck" spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0")
Add gem homepage to gemspec
diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index abc1234..def5678 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -8,4 +8,4 @@ # Precompile additional assets. # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. -Rails.application.config.assets.precompile += %w( analytics.js print.sass ) +Rails.application.config.assets.precompile += %w( analytics.js print.sass react-server.js components.js )
Fix for server-side rendering in production
diff --git a/ITWLoadingPanel.podspec b/ITWLoadingPanel.podspec index abc1234..def5678 100644 --- a/ITWLoadingPanel.podspec +++ b/ITWLoadingPanel.podspec @@ -1,11 +1,11 @@ Pod::Spec.new do |s| s.name = 'ITWLoadingPanel' - s.version = '1.0.0' + s.version = '1.0.1' s.license = 'Apache 2' s.summary = 'Drop in classes for adding a download info panel.' s.homepage = 'https://github.com/brunow/ITWLoadingPanel' s.author = { 'Bruno Wernimont' => 'bruno.wernimont+github@gmail.com' } - s.source = { :git => 'https://brunow@github.com/brunow/ITWLoadingPanel.git', :tag => '1.0.0' } + s.source = { :git => 'https://brunow@github.com/brunow/ITWLoadingPanel.git', :tag => '1.0.1' } s.description = 'ITWLoadingPanel is a class for adding a download info panel, made at Intotheweb.' s.platform = :ios
Update podspec with version 1.0.1
diff --git a/brightbytes-sendgrid.gemspec b/brightbytes-sendgrid.gemspec index abc1234..def5678 100644 --- a/brightbytes-sendgrid.gemspec +++ b/brightbytes-sendgrid.gemspec @@ -21,7 +21,7 @@ spec.add_development_dependency "bundler", "~> 1.5" spec.add_development_dependency "rake", "~> 10.1" spec.add_development_dependency "rspec", "~> 2.14" - spec.add_development_dependency "actionmailer", "~> 3.2" + spec.add_development_dependency "actionmailer", ">= 3.2", "< 5.0.0" spec.add_dependency "activesupport", ">= 3.2", "< 5.0.0" end
Update dev deps to support Rails 4.x
diff --git a/lib/event_store/messaging/stream_name.rb b/lib/event_store/messaging/stream_name.rb index abc1234..def5678 100644 --- a/lib/event_store/messaging/stream_name.rb +++ b/lib/event_store/messaging/stream_name.rb @@ -10,7 +10,7 @@ module Macro def category_macro(category_name) - category_name = Casing::Camel.! category_name + category_name = Casing::Camel.!(category_name) self.send :define_method, :category_name do category_name end
Order of precedence is enforced by parentheses
diff --git a/yoga_pants.gemspec b/yoga_pants.gemspec index abc1234..def5678 100644 --- a/yoga_pants.gemspec +++ b/yoga_pants.gemspec @@ -14,4 +14,10 @@ gem.name = "yoga_pants" gem.require_paths = ["lib"] gem.version = YogaPants::VERSION + + gem.add_runtime_dependency 'httpclient', '2.2.5' + gem.add_runtime_dependency 'multi_json', '1.3.6' + + gem.add_development_dependency 'rspec' + end
Add HTTPClient and MultiJson as deps
diff --git a/cookbooks/chef/attributes/default.rb b/cookbooks/chef/attributes/default.rb index abc1234..def5678 100644 --- a/cookbooks/chef/attributes/default.rb +++ b/cookbooks/chef/attributes/default.rb @@ -2,7 +2,7 @@ default[:apt][:sources] = node[:apt][:sources] | [ "opscode" ] # Set the default client version -default[:chef][:client][:version] = "11.4.4-1" +default[:chef][:client][:version] = "11.6.0-1" # A list of gems needed by chef recipes default[:chef][:gems] = []
Update chef client to 11.6.0-1
diff --git a/spec/controllers/moderation/reports_controller_spec.rb b/spec/controllers/moderation/reports_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/moderation/reports_controller_spec.rb +++ b/spec/controllers/moderation/reports_controller_spec.rb @@ -12,7 +12,7 @@ sign_in user end - it "renders the user/questions template" do + it "renders the moderation/reports/index template" do subject expect(response).to render_template("moderation/reports/index") end
Apply review suggestions from @nilsding Co-authored-by: Georg Gadinger <9e8f1a26fbf401b045347f083556ffd7c0b25a58@nilsding.org>
diff --git a/metaweblog.gemspec b/metaweblog.gemspec index abc1234..def5678 100644 --- a/metaweblog.gemspec +++ b/metaweblog.gemspec @@ -24,6 +24,6 @@ spec.require_paths = ["lib"] spec.add_development_dependency "bundler" - spec.add_development_dependency "rspec", "~> 2.14.0" + spec.add_development_dependency "rspec", "~> 2.99.0" spec.add_development_dependency "rake" end
Update 2.99.0 to check compatibility
diff --git a/lib/json_parser/class_methods/builder.rb b/lib/json_parser/class_methods/builder.rb index abc1234..def5678 100644 --- a/lib/json_parser/class_methods/builder.rb +++ b/lib/json_parser/class_methods/builder.rb @@ -71,4 +71,4 @@ @#{attribute} ||= #{attr_fetcher(attribute)} CODE end -end+end
Add end of line to file
diff --git a/lib/treetop/compiler/grammar_compiler.rb b/lib/treetop/compiler/grammar_compiler.rb index abc1234..def5678 100644 --- a/lib/treetop/compiler/grammar_compiler.rb +++ b/lib/treetop/compiler/grammar_compiler.rb @@ -6,23 +6,30 @@ target_file.write(ruby_source(source_path)) end end - - def ruby_source(source_path) - File.open(source_path) do |source_file| - parser = MetagrammarParser.new - result = parser.parse(source_file.read) - unless result - raise RuntimeError.new(parser.failure_reason) - end - result.compile + + # compile a string containing treetop source + def ruby_source_string(s) + parser = MetagrammarParser.new + result = parser.parse(s) + unless result + raise RuntimeError.new(parser.failure_reason) end + result.compile end end end + # compile a treetop source file and load it def self.load(path) adjusted_path = path =~ /\.(treetop|tt)\Z/ ? path : path + '.treetop' + File.open(adjusted_path) do |source_file| + load_string(source_file.read) + end + end + + # compile a treetop source string and load it + def self.load_string(s) compiler = Treetop::Compiler::GrammarCompiler.new - Object.class_eval(compiler.ruby_source(adjusted_path)) + Object.class_eval(compiler.ruby_source_string(s)) end end
Add Treetop.load_string which loads a grammar description stored in string. Refactor Treetop.load and replace ruby_source with ruby_source_string which compiles a source stored in string.
diff --git a/rspec-wait.gemspec b/rspec-wait.gemspec index abc1234..def5678 100644 --- a/rspec-wait.gemspec +++ b/rspec-wait.gemspec @@ -14,6 +14,8 @@ spec.files = `git ls-files -z`.split("\x0") spec.test_files = spec.files.grep(/^spec/) + spec.add_dependency "rspec", "~> 2.0" + spec.add_development_dependency "bundler", "~> 1.6" spec.add_development_dependency "rake", "~> 10.3" end
Add the RSpec runtime gem dependency
diff --git a/Casks/appfresh.rb b/Casks/appfresh.rb index abc1234..def5678 100644 --- a/Casks/appfresh.rb +++ b/Casks/appfresh.rb @@ -6,7 +6,16 @@ name 'AppFresh' appcast 'http://backend.metaquark.de/appcast/appfresh.xml' homepage 'http://metaquark.de/appfresh/mac' - license :unknown # todo: change license and remove this comment; ':unknown' is a machine-generated placeholder + license :commercial + tags :vendor => 'metaquark' - app 'appfresh.app' + zap :delete => [ + '~/Library/Application Support/AppFresh', + '~/Library/Application Support/Growl/Tickets/AppFresh.growlTicket', + '~/Library/Caches/de.metaquark.appfresh', + '~/Preferences/de.metaquark.appfresh.plist', + '~/Library/Saved Application State/de.metaquark.appfresh.savedState' + ] + + app 'AppFresh.app' end
Add license, vendor and zap for AppFresh.app
diff --git a/rack_jax.gemspec b/rack_jax.gemspec index abc1234..def5678 100644 --- a/rack_jax.gemspec +++ b/rack_jax.gemspec @@ -20,4 +20,6 @@ spec.add_development_dependency "bundler", "~> 1.6" spec.add_development_dependency "rake" + spec.add_development_dependency "rspec", "3.2.0" + end
Add rspec as a dependency
diff --git a/interactive-tests/interactives_sam_intermolecular-attractions_2-comparing-dipole-dipole-to-london-dispersion.rb b/interactive-tests/interactives_sam_intermolecular-attractions_2-comparing-dipole-dipole-to-london-dispersion.rb index abc1234..def5678 100644 --- a/interactive-tests/interactives_sam_intermolecular-attractions_2-comparing-dipole-dipole-to-london-dispersion.rb +++ b/interactive-tests/interactives_sam_intermolecular-attractions_2-comparing-dipole-dipole-to-london-dispersion.rb @@ -2,19 +2,19 @@ load 'interactive-tests/default.rb', true # FIXME: Clicking doesn't work on iPad, while on Android # pulldown menu option can't be selected. -return if :browser == 'Android' || :browser == 'iPad' - -$test.driver.find_element(:css, '.selectboxit').click -sleep 1 -$test.save_screenshot -$test.driver.find_element(:css, '.selectboxit-options li:nth-child(2) a').click -sleep 1 -$test.save_screenshot -$test.driver.find_element(:css, '.selectboxit').click -$test.driver.find_element(:css, '.selectboxit-options li:nth-child(3) a').click -sleep 1 -$test.save_screenshot -$test.driver.find_element(:css, '.selectboxit').click -$test.driver.find_element(:css, '.selectboxit-options li:nth-child(4) a').click -sleep 1 -$test.save_screenshot +unless $test.browser == :Android || $test.browser == :iPad + $test.driver.find_element(:css, '.selectboxit').click + sleep 1 + $test.save_screenshot + $test.driver.find_element(:css, '.selectboxit-options li:nth-child(2) a').click + sleep 1 + $test.save_screenshot + $test.driver.find_element(:css, '.selectboxit').click + $test.driver.find_element(:css, '.selectboxit-options li:nth-child(3) a').click + sleep 1 + $test.save_screenshot + $test.driver.find_element(:css, '.selectboxit').click + $test.driver.find_element(:css, '.selectboxit-options li:nth-child(4) a').click + sleep 1 + $test.save_screenshot +end
Fix "Comparing Dipole-Dipole to London Dispersion" test [#69191506]
diff --git a/spec/agnet_spec.rb b/spec/agnet_spec.rb index abc1234..def5678 100644 --- a/spec/agnet_spec.rb +++ b/spec/agnet_spec.rb @@ -1,11 +1,62 @@ require 'spec_helper' + describe Agnet do it 'has a version number' do expect(Agnet::VERSION).not_to be nil end - it 'does something useful' do - expect(false).to eq(true) + describe "public instance methods" do + subject { Agnet.new } + + + let(:input) { [input_activation,weights_hidden,weights_output,input_nodes,hidden_nodes,output_nodes] } + let(:output) { subject.process(input) } + context "responds to its methods" do + + it { expect(subject).to respond_to(:feed_forward) } + it { expect(subject).to respond_to(:set_initial_weights) } + + end + + context "executes methods correctly" do + context "#feed_forward" do + it "calcs weighted sum for each node in hidden layer with hidden weights" do + + end + + it "activates each node in hidden layer" do + + end + + it "cals weighted sum for each node in output layer with output weights" do + + end + + it "activates each node in output layer" do + + end + + end + context "#set_initial_weights" do + it "calcs initial factor for hidden weight matrix" do + end + it "calcs initial factor for output weight matrix" do + end + it "sets initial hidden layer weight matrix" do + end + it "sets initial output layer weight matrix" do + end + it "sets initial hidden weight matrix values between 0.5 and -0.5" do + end + it "sets initial output weight matrix values between 0.5 and -0.5" do + end + it "mulitplys hidden initial factor to hidden weight matrix cales" do + end + it "mulitplys output initial factor to hidden weight matrix cales" do + end + end + + end end end
Add instance methods tests for Agnet
diff --git a/spec/graph_spec.rb b/spec/graph_spec.rb index abc1234..def5678 100644 --- a/spec/graph_spec.rb +++ b/spec/graph_spec.rb @@ -2,4 +2,14 @@ describe Graph do + describe 'new' do + + it "should create a new graph with a name and no nodes" do + graph1 = Graph::Graph.new('graph1') + graph1.name.should eq('graph1') + graph1.nodes.empty?.should eq(true) + end + + end + end
Add a spec for the graph instantiation (new method).
diff --git a/app/controllers/donate_controller.rb b/app/controllers/donate_controller.rb index abc1234..def5678 100644 --- a/app/controllers/donate_controller.rb +++ b/app/controllers/donate_controller.rb @@ -30,7 +30,10 @@ amount: @amount, currency: 'usd', source: params[:stripe_token], - description: 'DocumentCloud donation' + description: 'DocumentCloud Donation', + metadata: { + type: 'donation', + }, ) rescue Stripe::CardError => e flash[:error] = e.message
Tag donations in Stripe metadata field
diff --git a/app/controllers/twitch_controller.rb b/app/controllers/twitch_controller.rb index abc1234..def5678 100644 --- a/app/controllers/twitch_controller.rb +++ b/app/controllers/twitch_controller.rb @@ -22,7 +22,7 @@ user.load_from_twitch(response) user.save - sign_in(:user, user) + sign_in(:user, user, remember_for: 100.years) if cookies[:return_to] redirect_to(cookies[:return_to])
Make sign in sessions last (way, way) longer