diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/recycling-helper/config/routes.rb b/recycling-helper/config/routes.rb index abc1234..def5678 100644 --- a/recycling-helper/config/routes.rb +++ b/recycling-helper/config/routes.rb @@ -29,5 +29,5 @@ resources :cities #get to 'cities#itemLookupResult' - root 'categories#index' + root 'cities#index' end
Update the root to cities/index
diff --git a/lib/regexp_parser/expression/classes/conditional.rb b/lib/regexp_parser/expression/classes/conditional.rb index abc1234..def5678 100644 --- a/lib/regexp_parser/expression/classes/conditional.rb +++ b/lib/regexp_parser/expression/classes/conditional.rb @@ -27,13 +27,13 @@ expressions.last << exp end - def branch(exp = nil) + def branch raise TooManyBranches.new if branches.length == 2 sequence = Branch.new(level, set_level, conditional_level + 1) expressions << sequence - branches << expressions.last + branches << sequence end def quantify(token, text, min = nil, max = nil, mode = :greedy) @@ -45,5 +45,4 @@ end end end - end
Remove unused argument and array indirection
diff --git a/lib/vagrant-proxyconf/action/configure_npm_proxy.rb b/lib/vagrant-proxyconf/action/configure_npm_proxy.rb index abc1234..def5678 100644 --- a/lib/vagrant-proxyconf/action/configure_npm_proxy.rb +++ b/lib/vagrant-proxyconf/action/configure_npm_proxy.rb @@ -24,7 +24,7 @@ def set_or_delete_proxy(key, value) if value - command = "npm config set #{key} #{escape(config.http)}" + command = "npm config set #{key} #{escape(value)}" else command = "npm config delete #{key}" end
Fix npm HTTPS proxy value The `https-proxy` npm config was defined using `config.http` proxyconf value (missing the `s`), which is wrong.
diff --git a/config/initializers/formats_filter.rb b/config/initializers/formats_filter.rb index abc1234..def5678 100644 --- a/config/initializers/formats_filter.rb +++ b/config/initializers/formats_filter.rb @@ -0,0 +1,11 @@+# frozen_string_literal: true + +# Patch for rails vulnerability CVE-2019-5418 and CVE-2019-5419 +# TODO: Remove this file after upgrading to rails 6 +ActionDispatch::Request.prepend(Module.new do + def formats + super().select do |format| + format.symbol || format.ref == '*/*' + end + end +end)
Patch for rails vulnerabilities CVE-2019-5418 and CVE-2019-5419
diff --git a/config/initializers/show_constants.rb b/config/initializers/show_constants.rb index abc1234..def5678 100644 --- a/config/initializers/show_constants.rb +++ b/config/initializers/show_constants.rb @@ -1,12 +1,12 @@ CURRENT_TOP_ROW_VALUES = [200, 400].freeze PLAY_TYPES = { + "toc" => "Tournament of Champions", "regular" => "regular play", "teachers" => "Teachers Tournament", "college" => "College Championship", "teen" => "Teen Tournament", "power" => "Power Players Week", - "toc" => "Tournament of Champions", "celebrity" => "Celebrity", "kids" => "Kids Week / Back to School Week", "decades" => "Battle of the Decades",
Reorder play-types list in preparation for ToC
diff --git a/lib/analysis/analyze_star_file_dates.rb b/lib/analysis/analyze_star_file_dates.rb index abc1234..def5678 100644 --- a/lib/analysis/analyze_star_file_dates.rb +++ b/lib/analysis/analyze_star_file_dates.rb @@ -0,0 +1,23 @@+require 'csv' +require 'date' + +path_to_file = ARGV[0] + +csv = CSV.read(path_to_file, headers: true) + +def star_date_to_ruby_date(star_date) + date_part = star_date.split(' ')[0] + month = date_part.split('/')[0].to_i + day = date_part.split('/')[1].to_i + year = date_part.split('/')[2].to_i + return Date.new(year, month, day) +end + +sorted_csv = csv.map { |row| star_date_to_ruby_date(row["AssessmentDate"]) } + +puts 'First date:' +puts sorted_csv.first +puts +puts +puts 'Last date:' +puts sorted_csv.last
Add script for looking at STAR dates
diff --git a/Auk.podspec b/Auk.podspec index abc1234..def5678 100644 --- a/Auk.podspec +++ b/Auk.podspec @@ -18,4 +18,5 @@ s.screenshots = "https://raw.githubusercontent.com/evgenyneu/Auk/master/Graphics/Screenshots/auk_paged_image_scroller_ios.jpg" s.source_files = "Auk/**/*.swift" s.ios.deployment_target = "8.0" + s.dependency "moa", git: 'https://github.com/evgenyneu/moa.git', tag: '7.0.0' end
Update to Xcode 8 beta 5
diff --git a/app/helpers/application_helper/button/miq_ae_namespace_edit.rb b/app/helpers/application_helper/button/miq_ae_namespace_edit.rb index abc1234..def5678 100644 --- a/app/helpers/application_helper/button/miq_ae_namespace_edit.rb +++ b/app/helpers/application_helper/button/miq_ae_namespace_edit.rb @@ -1,5 +1,10 @@-class ApplicationHelper::Button::MiqAeNamespaceEdit < ApplicationHelper::Button::MiqAeDomainLock +class ApplicationHelper::Button::MiqAeNamespaceEdit < ApplicationHelper::Button::MiqAeDomain needs :@record + + def disabled? + @error_message = N_('Domain is Locked.') if super + @error_message.present? + end def visible? super || editable_domain?(@record)
Fix the found error by modifying the inheritance hierarchy
diff --git a/spec/moshimoshi_rails_helper_spec.rb b/spec/moshimoshi_rails_helper_spec.rb index abc1234..def5678 100644 --- a/spec/moshimoshi_rails_helper_spec.rb +++ b/spec/moshimoshi_rails_helper_spec.rb @@ -6,7 +6,7 @@ end it "should return a greeting" do - email = "kristian@kristianfreeman.com" - @stub.moshimoshi_tag(email).should == "Foo" + email = "foo@bar.org" + @stub.moshimoshi_tag(email).should == "I'm foobar: I was used to test the API for this site and now I have to hang out by myself. Sad day. " end end
Update spec for foobar user
diff --git a/spec/request/api_key/api_key_spec.rb b/spec/request/api_key/api_key_spec.rb index abc1234..def5678 100644 --- a/spec/request/api_key/api_key_spec.rb +++ b/spec/request/api_key/api_key_spec.rb @@ -3,11 +3,17 @@ describe '/api_key' do it 'should return 401 with invalid credentials' do - create_user 'test@debox.com' get '/v1/api_key' last_response.should_not be_ok last_response.status.should eq 401 end + + it 'should return 401 with invalid credentials' do + get '/v1/api_key', user: 'test@debox.com' + last_response.should_not be_ok + last_response.status.should eq 401 + end + it 'should return token with valid credentials' do user = create_user 'test@debox.com'
Add spec if user provide user but not password
diff --git a/plugin/skype_logger.rb b/plugin/skype_logger.rb index abc1234..def5678 100644 --- a/plugin/skype_logger.rb +++ b/plugin/skype_logger.rb @@ -48,6 +48,8 @@ OSX::SkypeAPI.disconnect end + sleep(3); + OSX::SkypeAPI.setSkypeDelegate client OSX::SkypeAPI.connect rescue Object => e
Add sleep to avoid error on Skype 5.0.
diff --git a/spec/unit/contextio/api/lazy_attributes_spec.rb b/spec/unit/contextio/api/lazy_attributes_spec.rb index abc1234..def5678 100644 --- a/spec/unit/contextio/api/lazy_attributes_spec.rb +++ b/spec/unit/contextio/api/lazy_attributes_spec.rb @@ -0,0 +1,50 @@+require 'spec_helper' +require 'contextio/api/lazy_attributes' + +describe ContextIO::API::LazyAttributes do + let(:helper_class) do + Class.new do + extend ContextIO::API::LazyAttributes + + lazy_attributes :foo + + def fetch_attributes + @foo = 'set from API' + end + end + end + + subject { helper_class.new } + + it "defines a method for the attribute" do + expect(subject).to respond_to(:foo) + end + + context "when the instance variable is set" do + before do + subject.instance_variable_set(:@foo, 'set into instance variable') + end + + it "returns the value set" do + expect(subject.foo).to eq('set into instance variable') + end + + it "doesn't try to fetch from the API" do + subject.should_not_receive(:fetch_attributes) + + subject.foo + end + end + + context "when the instance variable is not set" do + it "tries to fetch from the API" do + subject.should_receive(:fetch_attributes) + + subject.foo + end + + it "returns the value from the API" do + expect(subject.foo).to eq('set from API') + end + end +end
Test the lazy attribute thing.
diff --git a/_plugins/monthly_archive_generator.rb b/_plugins/monthly_archive_generator.rb index abc1234..def5678 100644 --- a/_plugins/monthly_archive_generator.rb +++ b/_plugins/monthly_archive_generator.rb @@ -34,8 +34,8 @@ def add_to_bucket(post) @bucket[post.date.year] ||= default_bucket - @bucket[post.date.year][post.date.month] ||= default_bucket - @bucket[post.date.year][post.date.month][:posts] << post + @bucket[post.date.year][:subs][post.date.month] ||= default_bucket + @bucket[post.date.year][:subs][post.date.month][:posts] << post end def process
Fix a silly bug (Thanks mat813)
diff --git a/app/models/question.rb b/app/models/question.rb index abc1234..def5678 100644 --- a/app/models/question.rb +++ b/app/models/question.rb @@ -7,9 +7,36 @@ validates_presence_of :title validates_uniqueness_of :title + scope :last_seven_days, -> (num) { where(created_at: (Time.now - num.day)..Time.now)} + scope :last_fourteen_days, -> (num) { where(created_at: (Time.now - num.day)..Time.now)} + scope :last_twentyone_days, -> (num) { where(created_at: (Time.now - num.day)..Time.now)} + scope :last_twentyeight_days, -> (num) { where(created_at: (Time.now - num.day)..Time.now)} + def average_rating self.integer_answers.reduce(0) {|sum, answer| sum + answer.response }.to_f / self.integer_answers.length end + def total_tasks_completed + count = [] + self.boolean_answers.each do |answer| + if (answer.response == true) + count << answer.id + end + end + return count.length + end + + def total_boolean_responses + self.boolean_answers.count + end + + def total_integer_responses + self.integer_answers.count + end + + def total_text_responses + self.text_answers.count + end + end
Create methods to return stats on boolean integer and text responses
diff --git a/app/controllers/questions_controller.rb b/app/controllers/questions_controller.rb index abc1234..def5678 100644 --- a/app/controllers/questions_controller.rb +++ b/app/controllers/questions_controller.rb @@ -14,8 +14,9 @@ def create @question = Question.new(question_params) + p params if @question.save - redirect_to questions_path + redirect_to root_path end end @@ -27,7 +28,7 @@ @question = Question.find(params[:id]) @question.assign_attributes(question_params) if @question.save - redirect_to @question + redirect_to root_path else render :edit end @@ -37,7 +38,7 @@ @question = Question.find(params[:id]) @question.destroy flash[:notice] = "Question has been deleted" - redirect_to questions_path + redirect_to root_path end private
Change redirect to root path for update and create
diff --git a/spec/basic_parser_spec.rb b/spec/basic_parser_spec.rb index abc1234..def5678 100644 --- a/spec/basic_parser_spec.rb +++ b/spec/basic_parser_spec.rb @@ -0,0 +1,7 @@+require 'spec_helper' + +describe "BasicParser" do + it "should include Pidgin2Adium" do + Pidgin2Adium::BasicParser.included_modules.include?(Pidgin2Adium).should be_true + end +end
Add very basic spec for BasicParser
diff --git a/spec/models/topic_spec.rb b/spec/models/topic_spec.rb index abc1234..def5678 100644 --- a/spec/models/topic_spec.rb +++ b/spec/models/topic_spec.rb @@ -1,14 +1,15 @@ require 'rails_helper' RSpec.describe Topic do - it "allows setting the topic initially" do - topic = Topic.new(path: "/service-manual/hello", title: "anything", description: "anything") + it "allows setting the topic path that starts with '/service-manual/'" do + topic = Generators.valid_topic(path: "/service-manual/hello") topic.valid? expect(topic.errors[:path].size).to eq 0 end it "doesn't allow changing the path again" do - topic = Topic.create!(path: "/service-manual/something", title: "anything", description: "anything") + topic = Generators.valid_topic(path: "/service-manual/hello") + topic.save! topic.path = "/service-manual/wemklfenlkwecw" topic.valid? expect(topic.errors[:path].size).to eq 1
Use the new generator in topic specs Use valid topic generator in topic specs and improve test descriptions
diff --git a/test/integration/users_login_test.rb b/test/integration/users_login_test.rb index abc1234..def5678 100644 --- a/test/integration/users_login_test.rb +++ b/test/integration/users_login_test.rb @@ -34,6 +34,7 @@ password: ENV["SCRIVITO_PASSWORD"] } assert_redirected_to "/sotechsha/gazou" follow_redirect! - assert_template "blog_post_page/index.html" + # assert_template "blog_post_page/index.html" + assert_equal "/sotechsha/gazou", path end end
Change test by assert_template to aseert_equal path
diff --git a/lib/analytical/modules/chartbeat.rb b/lib/analytical/modules/chartbeat.rb index abc1234..def5678 100644 --- a/lib/analytical/modules/chartbeat.rb +++ b/lib/analytical/modules/chartbeat.rb @@ -21,16 +21,18 @@ js = <<-HTML <!-- Analytical Body Init: Chartbeat --> <script type="text/javascript"> - var _sf_async_config={uid:#{options[:key]}, domain:"#{options[:domain]}"}; + var _sf_async_config={}; + /** CONFIGURATION START **/ + _sf_async_config.uid = #{options[:key]}; + _sf_async_config.domain = '#{options[:domain]}'; + /** CONFIGURATION END **/ (function(){ function loadChartbeat() { window._sf_endpt=(new Date()).getTime(); var e = document.createElement('script'); e.setAttribute('language', 'javascript'); e.setAttribute('type', 'text/javascript'); - e.setAttribute('src', - (("https:" == document.location.protocol) ? "https://s3.amazonaws.com/" : "http://") + - "static.chartbeat.com/js/chartbeat.js"); + e.setAttribute('src', '//static.chartbeat.com/js/chartbeat.js'); document.body.appendChild(e); } var oldonload = window.onload; @@ -46,4 +48,4 @@ end end -end+end
Update Chartbeat script to latest version https://chartbeat.com/docs/adding_the_code/
diff --git a/lib/rrimm/feed_config_extensions.rb b/lib/rrimm/feed_config_extensions.rb index abc1234..def5678 100644 --- a/lib/rrimm/feed_config_extensions.rb +++ b/lib/rrimm/feed_config_extensions.rb @@ -4,8 +4,12 @@ module RRImm module FeedConfigExtensions - def select(&block) - @massages << { select: block} + def method_missing(name, *args, &block) + if Enumerable.instance_methods(false).include? name + @massages << { name => block } + else + raise NoMethodError + end end end
Add all Enumerable methods in FeedConfigExtensions
diff --git a/lib/yard/handlers/method_handler.rb b/lib/yard/handlers/method_handler.rb index abc1234..def5678 100644 --- a/lib/yard/handlers/method_handler.rb +++ b/lib/yard/handlers/method_handler.rb @@ -4,7 +4,12 @@ def process nobj = namespace mscope = scope - meth = statement.tokens.to_s[/^def\s+(#{METHODMATCH})/m, 1].gsub(/\s+/,'') + + if meth = statement.tokens.to_s[/^def\s+(#{METHODMATCH})/m, 1] + meth.gsub!(/\s+/,'') + else + raise YARD::Handlers::UndocumentableError, "method: invalid name" + end # Class method if prefixed by self(::|.) or Module(::|.) if meth =~ /(?:#{NSEP}|\.)([^#{NSEP}\.]+)$/
Improve error handling / message for invalid methods
diff --git a/app/models/assertion_id_request_service.rb b/app/models/assertion_id_request_service.rb index abc1234..def5678 100644 --- a/app/models/assertion_id_request_service.rb +++ b/app/models/assertion_id_request_service.rb @@ -10,10 +10,10 @@ return if owners.one? errors.add(:ownership, - 'must be related to idp_sso_descriptor or - attribute_authority_descriptor') && return if owners.none? + 'must be related to idp_sso_descriptor or ' \ + 'attribute_authority_descriptor') && return if owners.none? - errors.add(:ownership, 'cannot be owned by both idp_sso_descriptor - and attribute_authority_descriptor') + errors.add(:ownership, 'cannot be owned by both idp_sso_descriptor ' \ + 'and attribute_authority_descriptor') end end
Correct concatination in error message
diff --git a/lib/llt/diff/parser/nokogiri_handler.rb b/lib/llt/diff/parser/nokogiri_handler.rb index abc1234..def5678 100644 --- a/lib/llt/diff/parser/nokogiri_handler.rb +++ b/lib/llt/diff/parser/nokogiri_handler.rb @@ -0,0 +1,30 @@+require 'nokogiri' + +module LLT + class Diff::Parser + class NokogiriHandler < Nokogiri::XML::SAX::Document + + attr_reader :result + + def initialize + @result = ParseResult.new + end + + def parse(data) + Nokogiri::XML::SAX::Parser.new(self).parse(data) + end + + def start_element(name, attrs = []) + case name + when 'word' + word = Word.new(attrs.shift.last.to_i) + attrs.each { |k, v| word.send("#{k}=", v) } + @sentence.add(word) + when 'sentence' + @sentence = Sentence.new(attrs.first.last.to_i) + @result.add(@sentence) + end + end + end + end +end
Add NokogiriHandler for Sax parsing In theory this should solve #3 - it does so in fact, however jruby seems to contain a bug in regards to multi-threading. Still investigating if that assertion is true and how it can be fixed.
diff --git a/lib/transition/import/whitehall_orgs.rb b/lib/transition/import/whitehall_orgs.rb index abc1234..def5678 100644 --- a/lib/transition/import/whitehall_orgs.rb +++ b/lib/transition/import/whitehall_orgs.rb @@ -4,7 +4,9 @@ module Import class WhitehallOrgs ## - # Place to put complete cached copy of orgs API + # Place to put complete cached copy of orgs API. + # Cache expires when the date changes, so could be valid + # for up to 24 hours. def cached_org_path "/tmp/all_whitehall_orgs-#{DateTime.now.strftime('%Y-%m-%d')}.yaml" end
Comment on cache TTL for Whitehall responses
diff --git a/app/workers/unauthorized_user_worker.rb b/app/workers/unauthorized_user_worker.rb index abc1234..def5678 100644 --- a/app/workers/unauthorized_user_worker.rb +++ b/app/workers/unauthorized_user_worker.rb @@ -3,7 +3,7 @@ class UnauthorizedUserWorker include Sidekiq::Worker - REVOKED_MESSAGES = ["O token de acesso foi revogado", "The access token was revoked", "Il token di accesso è stato disabilitato", "The access token is invalid"] + REVOKED_MESSAGES = ["O token de acesso foi revogado", "The access token was revoked", "Il token di accesso è stato disabilitato", "The access token is invalid", "アクセストークンは取り消されています", "Le jeton d’accès a été révoqué", "Der Zugriffs-Token wurde widerrufen", "access token 已被取消"] def perform(id) @user = User.find(id)
Add more strings of revoked messages
diff --git a/app/controllers/graphql_controller.rb b/app/controllers/graphql_controller.rb index abc1234..def5678 100644 --- a/app/controllers/graphql_controller.rb +++ b/app/controllers/graphql_controller.rb @@ -1,4 +1,6 @@ class GraphqlController < ApplicationController + protect_from_forgery with: :null_session + def execute variables = ensure_hash(params[:variables]) query = params[:query]
Make CSRF token unnessesary for GraphQL API
diff --git a/app/presenters/lifecycle_presenter.rb b/app/presenters/lifecycle_presenter.rb index abc1234..def5678 100644 --- a/app/presenters/lifecycle_presenter.rb +++ b/app/presenters/lifecycle_presenter.rb @@ -13,10 +13,15 @@ else event.user end + organization = if event.organization.nil? + {} + else + OrganizationIndexPresenter.new(event.organization) + end h[event_name] = { timestamp: event.created_at, user: UserPresenter.new(user), - organization: OrganizationIndexPresenter.new(event.organization), + organization: organization, } end end
Handle lifecycle events without an organization
diff --git a/spec/hello_sign/api/embedded_spec.rb b/spec/hello_sign/api/embedded_spec.rb index abc1234..def5678 100644 --- a/spec/hello_sign/api/embedded_spec.rb +++ b/spec/hello_sign/api/embedded_spec.rb @@ -12,6 +12,10 @@ expect(a_get("/embedded/sign_url/#{signature_id}")).to have_been_made end + it 'should return response headers' do + expect(@embedded.headers).to_not be_nil + end + it 'should return a UnclaimedDraft' do expect(@embedded).to be_an HelloSign::Resource::Embedded end
Add response header test for Get Embedded Sign URL
diff --git a/spec/weather_reporter/config_spec.rb b/spec/weather_reporter/config_spec.rb index abc1234..def5678 100644 --- a/spec/weather_reporter/config_spec.rb +++ b/spec/weather_reporter/config_spec.rb @@ -27,8 +27,8 @@ describe '#read_file' do it 'gets file object as hash' do - expect(config_class.new(path: file_path).read_file['API_KEY']['APIXU']) - .to(eq(YAML.load_file(config_class::CONFIG_FILE_PATH)['API_KEY']['APIXU'])) + expect(config_class.new(path: file_path).read_file['APIXU']['API_KEY']) + .to(eq(YAML.load_file(config_class::CONFIG_FILE_PATH)['APIXU']['API_KEY'])) end end end
Set key value of a hash as yaml file
diff --git a/publify_textfilter_code.gemspec b/publify_textfilter_code.gemspec index abc1234..def5678 100644 --- a/publify_textfilter_code.gemspec +++ b/publify_textfilter_code.gemspec @@ -9,7 +9,7 @@ s.version = PublifyTextfilterCode::VERSION s.authors = ['Matijs van Zuijlen'] s.email = ['matijs@matijs.net'] - s.homepage = 'https://publify.co' + s.homepage = 'https://publify.github.io/' s.summary = 'Code text filter for the Publify blogging system.' s.description = 'Code text filter sidebar for the Publify blogging system.' s.license = 'MIT'
Replace references to expired publify.co domain
diff --git a/ci_environment/haskell/attributes/multi.rb b/ci_environment/haskell/attributes/multi.rb index abc1234..def5678 100644 --- a/ci_environment/haskell/attributes/multi.rb +++ b/ci_environment/haskell/attributes/multi.rb @@ -1,4 +1,4 @@ default[:haskell][:multi] = { - :ghcs => ["7.8.1","7.6.3","7.4.2","7.0.4"], + :ghcs => ["7.8.2","7.6.3","7.4.2","7.0.4"], :default => "7.6.3" }
Use ghc-7.8.2 instead of 7.8.1
diff --git a/mongoid_magic_counter_cache.gemspec b/mongoid_magic_counter_cache.gemspec index abc1234..def5678 100644 --- a/mongoid_magic_counter_cache.gemspec +++ b/mongoid_magic_counter_cache.gemspec @@ -19,7 +19,7 @@ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } s.require_paths = ["lib"] - s.add_dependency("mongoid", ">= 2.2", "<= 3.0.0.rc") + s.add_dependency("mongoid", ">= 2.2", "<= 3.0") s.add_dependency("rake") s.add_dependency("bson_ext","~> 1.5") s.add_development_dependency "rspec"
Allow mongoid versions up to 3.0.X
diff --git a/db/migrate/20100624151555_allow_null_for_association_fields.rb b/db/migrate/20100624151555_allow_null_for_association_fields.rb index abc1234..def5678 100644 --- a/db/migrate/20100624151555_allow_null_for_association_fields.rb +++ b/db/migrate/20100624151555_allow_null_for_association_fields.rb @@ -0,0 +1,13 @@+class AllowNullForAssociationFields < ActiveRecord::Migration + def self.up + change_column :pages, "questionnaire_id", :integer, :default => 0, :null => false + change_column :question_options, "question_id", :integer, :default => 0, :null => false + change_column :questions, "page_id", :integer, :default => 0, :null => false + end + + def self.down + change_column :pages, "questionnaire_id", :integer, :null => false + change_column :question_options, "question_id", :integer, :null => false + change_column :questions, "page_id", :integer, :null => false + end +end
Allow null for association fields (needed to prevent factory_girl from dying on build callbacks)
diff --git a/spec/integration/contract_spec.rb b/spec/integration/contract_spec.rb index abc1234..def5678 100644 --- a/spec/integration/contract_spec.rb +++ b/spec/integration/contract_spec.rb @@ -22,7 +22,7 @@ describe '#inspect' do it 'returns a string representation' do expect(contract.inspect).to eql( - %(#<Test::NewUserContract schema=#<Dry::Schema::Params keys=["email"] rules={:email=>"key?(:email) AND key[email](str?)"}> rules=[#<Dry::Validation::Rule keys=[:email]>]>) + %(#<Test::NewUserContract schema=#<Dry::Schema::Params keys=["email"] rules={:email=>"key?(:email) AND key[email](filled? AND str?)"}> rules=[#<Dry::Validation::Rule keys=[:email]>]>) ) end end
Update spec to reflect changes in dry-schema
diff --git a/spec/ruby/language/module_spec.rb b/spec/ruby/language/module_spec.rb index abc1234..def5678 100644 --- a/spec/ruby/language/module_spec.rb +++ b/spec/ruby/language/module_spec.rb @@ -34,6 +34,17 @@ module LangModuleSpec::C2; end }.should raise_error(TypeError) end + + it "allows for reopening a module subclass" do + class ModuleSubClass < Module; end + LangModuleSpec::C3 = ModuleSubClass.new + + module LangModuleSpec::C3 + C4 = 4 + end + + LangModuleSpec::C3::C4.should == 4 + end end describe "An anonymous module" do
Add spec for reopening a sub class of Module
diff --git a/spec/unit/recipes/install_spec.rb b/spec/unit/recipes/install_spec.rb index abc1234..def5678 100644 --- a/spec/unit/recipes/install_spec.rb +++ b/spec/unit/recipes/install_spec.rb @@ -38,6 +38,13 @@ "execute[install-dokku-plugin-core-dependencies]").to(:run).immediately end + it "removes conflicing default configuration" do + resource = chef_run.file( + "/etc/nginx/conf.d/server_names_hash_bucket_size.conf") + + expect(resource).to notify("service[nginx]").to(:restart).delayed + end + it "creates the domain file" do expect(chef_run).to create_file("/home/dokku/VHOST") end
Test default configuration is removed on install. This is added when the core dependencies task is executed, and we should test that it is there.
diff --git a/app/serializers/payment_serializer.rb b/app/serializers/payment_serializer.rb index abc1234..def5678 100644 --- a/app/serializers/payment_serializer.rb +++ b/app/serializers/payment_serializer.rb @@ -1,8 +1,37 @@ class PaymentSerializer < ActiveModel::Serializer attributes :id, :name, :amount, :category_id, :category_name, :category_type, - :type, :schedule, :upcoming + :type, :schedule, :upcoming, :repeat, :repeat_interval, :repeat_period, :date + + def repeat + schedule.recurrence_rules.length > 0 + end + + def repeat_interval + # FIXME: this is a bit yuck + first_rule.instance_variable_get(:@interval) + end + + def repeat_period + case first_rule.class.to_s + when 'IceCube::DailyRule' + 'Day' + when 'IceCube::WeeklyRule' + 'Week' + when 'IceCube::MonthlyRule' + 'Month' + end + end + + def date + schedule.start_time.strftime('%Y-%m-%d') + end def upcoming schedule.occurrences_between(Date.today, Date.today + 30.days) end + + private + def first_rule + schedule.recurrence_rules.first + end end
Add `repeat`, `repeat_interval` , `repeat_period` and `date` to payment json.
diff --git a/app/services/remove_status_service.rb b/app/services/remove_status_service.rb index abc1234..def5678 100644 --- a/app/services/remove_status_service.rb +++ b/app/services/remove_status_service.rb @@ -34,6 +34,7 @@ end def send_delete_salmon(account, status) + return unless status.local? NotificationWorker.perform_async(status.stream_entry.id, account.id) end
Fix RemoveStatusService trying to send delete salmons on behalf of remote statuses
diff --git a/lib/game.rb b/lib/game.rb index abc1234..def5678 100644 --- a/lib/game.rb +++ b/lib/game.rb @@ -12,29 +12,29 @@ end def run() + # Loop until @hangman.won or @hangman.lost, guessing, or potentially quitting until @hangman.finished? guess = get_guess break unless guess - @hangman.guess guess + @hangman.guess(guess) end # Clear screen, print final gamestate - @presenter.display_game @hangman + @presenter.display_game(@hangman) end def get_guess() - # Loop until @hangman.won or @hangman.lost begin # Display game - @presenter.display_game @hangman + @presenter.display_game(@hangman) # Read input - @presenter.display_error @error + @presenter.display_error(@error) guess = @presenter.ask_for_letter # Validate input if guess == "\u0003" # ctrl-c, SIGINT raise Interrupt end if guess == "\u0004" # ctrl-d, EOF - # @hangman.lost + # Quit the game return end end while @error = validate(guess) @@ -43,7 +43,7 @@ def validate(guess) begin - @hangman.validate_letter guess + @hangman.validate_letter(guess) rescue NotLowerCaseLetterError :inputisnotlowercase rescue AlreadyGuessedError
Add parens round stuff, clean up comments
diff --git a/lib/loaf.rb b/lib/loaf.rb index abc1234..def5678 100644 --- a/lib/loaf.rb +++ b/lib/loaf.rb @@ -6,6 +6,9 @@ require 'loaf/controller_extensions' require 'loaf/view_extensions' require 'loaf/crumb_formatter' + +# Add English load path by default +I18n.load_path << File.join(File.dirname(__FILE__), 'config', 'locales', 'en.yml') module Loaf extend Configuration
Include locales during lib load.
diff --git a/lib/concurrent/thread_safe/util/array_hash_rbx.rb b/lib/concurrent/thread_safe/util/array_hash_rbx.rb index abc1234..def5678 100644 --- a/lib/concurrent/thread_safe/util/array_hash_rbx.rb +++ b/lib/concurrent/thread_safe/util/array_hash_rbx.rb @@ -13,6 +13,12 @@ def initialize(*args) _mon_initialize super + end + + def self.allocate + obj = super + obj.send(:_mon_initialize) + obj end end
Fix Array/Hash monitor not being initialized Fixes several broken testcases in the Array and Hash specs.
diff --git a/config/initializers/loofah_configure.rb b/config/initializers/loofah_configure.rb index abc1234..def5678 100644 --- a/config/initializers/loofah_configure.rb +++ b/config/initializers/loofah_configure.rb @@ -8,6 +8,6 @@ if ENV["WLTAGS"] tag_list = Loofah::HTML5::WhiteList::ALLOWED_ELEMENTS_WITH_LIBXML2 tag_list += ENV["WLTAGS"].split - Loofah::HTML5::WhiteList::send :remove_const, :ALLOWED_ELEMENTS_WITH_LIBXML2 - Loofah::HTML5::WhiteList::const_set :ALLOWED_ELEMENTS_WITH_LIBXML2, tag_list + Loofah::HTML5::WhiteList.send :remove_const, :ALLOWED_ELEMENTS_WITH_LIBXML2 + Loofah::HTML5::WhiteList.const_set :ALLOWED_ELEMENTS_WITH_LIBXML2, tag_list end
Use dot for method call
diff --git a/brew/cromer_template.rb b/brew/cromer_template.rb index abc1234..def5678 100644 --- a/brew/cromer_template.rb +++ b/brew/cromer_template.rb @@ -4,6 +4,8 @@ url "https://github.com/andrewferrier/cromer/archive/X.Y.zip" version "X.Y" + depends_on :python3 + def install bin.install "cromer" doc.install "README.md", "LICENSE.txt"
Add dependency on Python 3 in brewfile.
diff --git a/gems/pending/spec/coverage_helper.rb b/gems/pending/spec/coverage_helper.rb index abc1234..def5678 100644 --- a/gems/pending/spec/coverage_helper.rb +++ b/gems/pending/spec/coverage_helper.rb @@ -1,7 +1,7 @@ require 'active_support/core_ext/kernel/reporting' # Require all ruby files for accuracte test coverage reports -EXCLUSIONS_LIST = %w(/bin/ /ext/ /spec/ /test/ /vendor/ appliance_console.rb bundler_setup.rb test.rb require_with_logging.rb VixDiskLibServer.rb) +EXCLUSIONS_LIST = %w(/bin/ /ext/ /spec/ /test/ /vendor/ appliance_console.rb bundler_setup.rb test.rb require_with_logging.rb VixDiskLibServer.rb VMwareWebService/wsdl41 ) Dir.glob(File.join(GEMS_PENDING_ROOT, "**", "*.rb")).each do |file| next if EXCLUSIONS_LIST.any? { |exclusion| file.include?(exclusion) } begin
Exclude the vim wsdl41 mapping registry from test code coverage The vim wsdl mapping registry translated to ruby will never be covered. Their library's wsdl should be tested by them, not us. Having it in the coverage_helper provides us no benefit since we won't be adding code coverage in our test suite for this.
diff --git a/smart_properties.gemspec b/smart_properties.gemspec index abc1234..def5678 100644 --- a/smart_properties.gemspec +++ b/smart_properties.gemspec @@ -24,6 +24,6 @@ gem.version = SmartProperties::VERSION gem.add_development_dependency "rspec", "~> 3.0" - gem.add_development_dependency "rake", "~> 12.0" + gem.add_development_dependency "rake", "~> 13.0" gem.add_development_dependency "pry" end
Update rake from Version 12 to Version 13
diff --git a/spec/factories/operating_systems.rb b/spec/factories/operating_systems.rb index abc1234..def5678 100644 --- a/spec/factories/operating_systems.rb +++ b/spec/factories/operating_systems.rb @@ -19,9 +19,11 @@ factory :centos, class: OperatingSystem do sequence(:name) { |n| "centos_#{n}" } + version '6.5' end factory :ubuntu, class: OperatingSystem do sequence(:name) { |n| "ubuntu_#{n}" } + version '14.04' end end
Add version to factory for OperatingSystem
diff --git a/spec/henson/friendly_errors_spec.rb b/spec/henson/friendly_errors_spec.rb index abc1234..def5678 100644 --- a/spec/henson/friendly_errors_spec.rb +++ b/spec/henson/friendly_errors_spec.rb @@ -0,0 +1,12 @@+require 'spec_helper' +require 'henson/friendly_errors' + +describe "Henson.friendly_errors" do + it "rescues Henson::InvalidSourceError" do + lambda { + Henson.with_friendly_errors do + raise Henson::InvalidSourceError + end + }.should_not raise_error(Henson::InvalidSourceError) + end +end
Fix coverage by adding specs for friendly errors
diff --git a/rails/script/update.rb b/rails/script/update.rb index abc1234..def5678 100644 --- a/rails/script/update.rb +++ b/rails/script/update.rb @@ -4,9 +4,9 @@ puts "Fetching latest Rails locale files to #{rails_locale_dir}" exec %( - curl -Lo '#{rails_locale_dir}/action_view.yml' http://github.com/rails/rails/tree/master/actionpack/lib/action_view/locale/en.yml?raw=true + curl -Lo '#{rails_locale_dir}/action_view.yml' https://raw.github.com/rails/rails/master/actionview/lib/action_view/locale/en.yml - curl -Lo '#{rails_locale_dir}/active_record.yml' http://github.com/rails/rails/tree/master/activerecord/lib/active_record/locale/en.yml?raw=true + curl -Lo '#{rails_locale_dir}/active_record.yml' https://raw.github.com/rails/rails/master/activerecord/lib/active_record/locale/en.yml - curl -Lo '#{rails_locale_dir}/active_support.yml' http://github.com/rails/rails/tree/master/activesupport/lib/active_support/locale/en.yml?raw=true + curl -Lo '#{rails_locale_dir}/active_support.yml' https://raw.github.com/rails/rails/master/activesupport/lib/active_support/locale/en.yml )
Update urls of rails' :en locale files in Rails locale fetch script
diff --git a/spec/requests/idea_requests_spec.rb b/spec/requests/idea_requests_spec.rb index abc1234..def5678 100644 --- a/spec/requests/idea_requests_spec.rb +++ b/spec/requests/idea_requests_spec.rb @@ -7,7 +7,7 @@ end describe "GET /ideas" do - it "return http success" do + it "should return http success" do get ideas_path expect(response).to be_success end @@ -20,21 +20,21 @@ post_via_redirect user_session_path, 'user[email]' => @user.email, 'user[password]' => @user.password end - it "return http success" do + it "should return http success" do get new_idea_path expect(response).to be_success end end describe "GET /ideas/:id/edit" do - it "return http success" do + it "should return http success" do get edit_idea_path(:id => @idea1.id) expect(response).to be_success end end describe "GET /ideas/:id" do - it "return http success" do + it "should return http success" do get idea_path(:id => @idea2.id) expect(response).to be_success end
Add 'should' to idea request expectation message Make expectations of tests a little more clear.
diff --git a/spec/shared/hash_method_behavior.rb b/spec/shared/hash_method_behavior.rb index abc1234..def5678 100644 --- a/spec/shared/hash_method_behavior.rb +++ b/spec/shared/hash_method_behavior.rb @@ -3,11 +3,16 @@ shared_examples_for 'a hash method' do it_should_behave_like 'an idempotent method' - # TOOD: figure out if #hash under rbx should also always use Fixnum - if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx' - it { should be_kind_of(Integer) } - else - it { should be_instance_of(Fixnum) } + specification = lambda do + should be_instance_of(Fixnum) + end + + it 'is a fixnum' do + if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx' + pending('Under rubinius #hash does not always use a Fixnum', &specification) + else + instance_eval(&specification) + end end it 'memoizes the hash code' do
Change spec to be pending in rbx rather than just skipping it
diff --git a/docs/analytics_scripts/ticket_open_time.rb b/docs/analytics_scripts/ticket_open_time.rb index abc1234..def5678 100644 --- a/docs/analytics_scripts/ticket_open_time.rb +++ b/docs/analytics_scripts/ticket_open_time.rb @@ -0,0 +1,7 @@+CSV.open("/home/sage/ticket_status.csv", 'wb') do |csv| + csv << ['opened', 'updated', 'time_difference', 'status', 'message_count', 'owner'] + TicketDispenser::Ticket.all.includes(:owner).each do |ticket| + csv << [ticket.created_at, ticket.updated_at, ticket.updated_at - ticket.created_at, ticket.status, ticket.messages.count, ticket.owner&.username] + end +end +
Add script for getting data on ticket open-to-closed time
diff --git a/event_store-entity_projection.gemspec b/event_store-entity_projection.gemspec index abc1234..def5678 100644 --- a/event_store-entity_projection.gemspec +++ b/event_store-entity_projection.gemspec @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'event_store-entity_projection' - s.version = '0.1.2' + s.version = '0.2.0' s.summary = 'Projects an event stream into an entity' s.description = ' '
Package version was increased from 0.1.2 to 0.2.0
diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index abc1234..def5678 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -3,7 +3,8 @@ # comments for posts controller class CommentsController < ApplicationController before_action :find_post - before_action :find_comment, only: %i[edit update destroy] + before_action :find_comment, only: %i[edit update destroy comment_owner] + before_action :comment_owner, only: %i[edit update destroy] def create @comment = @post.comments.create(comment_params) @@ -42,4 +43,10 @@ def find_comment @comment = @post.comments.find(params[:id]) end + + def comment_owner + flash[:notice] = 'Only owner of the comment can delete or update' unless + current_member.id == @comment.member_id + redirect_to post_path(@post) unless current_member.id == @comment.member_id + end end
Allow only comment owner to delete or edit their comment
diff --git a/app/controllers/loaderio_controller.rb b/app/controllers/loaderio_controller.rb index abc1234..def5678 100644 --- a/app/controllers/loaderio_controller.rb +++ b/app/controllers/loaderio_controller.rb @@ -10,6 +10,6 @@ private def token - "loaderio-#{ENV['LOADERIO_VERIFICATION_TOKEN']}" + ENV['LOADERIO_VERIFICATION_TOKEN'] end end
Remove extra prefix for token
diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index abc1234..def5678 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -4,7 +4,7 @@ def create @message = Message.new(message_params.merge(sender_id: current_user.id)) - if @message.save! + if @message.save notification = { notice: 'Message successfully sent' } else notification = { alert: 'Message not sent: ' + @message.errors.full_messages.join(', ') }
Remove bang, should not raise exception when invalid
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index abc1234..def5678 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -1,8 +1,28 @@ class SessionsController < Devise::SessionsController - + # Require our abstraction for encoding/deconding JWT. + require 'auth_token' + + respond_to :json + + def create + + # This is the default behavior from devise - view the sessions controller source: + # https://github.com/plataformatec/devise/blob/master/app/controllers/devise/sessions_controller.rb + self.resource = warden.authenticate!(auth_options) + set_flash_message(:notice, :signed_in) if is_flashing_format? + sign_in(resource_name, resource) + yield resource if block_given? + + # Here we're deviating from the standard behavior by issuing our JWT + # to any JS based client. + token = AuthToken.issue_token({ user_id: resource.id }) + respond_with resource, location: after_sign_in_path_for(resource) do |format| + format.json { render json: {email: resource.email, displayName: resource.name, jwt_token: token} } + end + end + def destroy #current_user.authentications.where(provider: 'canvas').destroy_all super end - -end+end
Update session controller to return jwt token upon login
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index abc1234..def5678 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -1,3 +1,23 @@ class SessionsController < ApplicationController + def new + end + + def create + user = User.find_by(email: params[:email]) + + if user && user.authenticate(params[:password]) + session[:user_id] = user.id + redirect_to root_path + else + flash[:notice] = "Invalid login!" + render :new + end + + def logout + session.clear + flash[:notice] = "Signed out!" + redirect_to root_path + end + end
Add new, create, and logout routes to sessions controller
diff --git a/app/controllers/orders_controller.rb b/app/controllers/orders_controller.rb index abc1234..def5678 100644 --- a/app/controllers/orders_controller.rb +++ b/app/controllers/orders_controller.rb @@ -1,6 +1,7 @@ class OrdersController < ApplicationController def index @orders = Order.all + @cart ||= [] end def new
Create instance variable @cart ||= []
diff --git a/app/controllers/static_controller.rb b/app/controllers/static_controller.rb index abc1234..def5678 100644 --- a/app/controllers/static_controller.rb +++ b/app/controllers/static_controller.rb @@ -1,6 +1,9 @@ # used to serve static angular templates from under app/views/static/ class StaticController < ActionController::Base + # Added to satisfy Brakeman + protect_from_forgery + # hide_action is gone in Rails, but high_voltage is still using it. # https://github.com/thoughtbot/high_voltage/pull/214 def self.hide_action(*)
Add `protect_from_forgery` to satisfy Brakeman
diff --git a/app/serializers/serial_serializer.rb b/app/serializers/serial_serializer.rb index abc1234..def5678 100644 --- a/app/serializers/serial_serializer.rb +++ b/app/serializers/serial_serializer.rb @@ -1,5 +1,10 @@ class SerialSerializer < ActiveModel::Serializer attributes :id, :title, :description, :thumbnail_url + meta do + { + posts_count: object.posts.published.count + } + end def thumbnail_url scope.image_url(object.thumbnail_url)
Add posts_count as meta for serials page
diff --git a/sensu/plugins/check-os-api.rb b/sensu/plugins/check-os-api.rb index abc1234..def5678 100644 --- a/sensu/plugins/check-os-api.rb +++ b/sensu/plugins/check-os-api.rb @@ -29,7 +29,7 @@ when "glance" "glance image-list" when "keystone" - "keystone endpoint-list" + "openstack endpoint list" when "heat" "heat stack-list" when "ceilometer"
Replace keystone client usage w/ openstack client With the most recent keystoneclient releases, the `keystone` client is removed in favor of the `openstack` client. Change this check as such.
diff --git a/spec/plugin/go_spec.rb b/spec/plugin/go_spec.rb index abc1234..def5678 100644 --- a/spec/plugin/go_spec.rb +++ b/spec/plugin/go_spec.rb @@ -3,15 +3,18 @@ describe "go" do let(:filename) { 'test.go' } - before :each do - vim.set 'expandtab' - vim.set 'shiftwidth', 4 + # Go is not built-in, so let's set it up manually + def setup_go_filetype + vim.set(:filetype, 'go') + vim.set(:expandtab) # not canonical, but easier to test + vim.set(:shiftwidth, 4) end specify "structs" do set_file_contents <<-EOF StructType{one: 1, two: "asdf", three: []int{1, 2, 3}} EOF + setup_go_filetype split
Make go spec independent of filetype detection
diff --git a/week-4/basic-math.rb b/week-4/basic-math.rb index abc1234..def5678 100644 --- a/week-4/basic-math.rb +++ b/week-4/basic-math.rb @@ -0,0 +1,83 @@+# Solution Below + +num1 = 42 +num2 = 37 + +sum = num1+num2 +difference = num1-num2 +quotient=num1/num2.to_f +product = num1*num2 +modulus = num1%num2 + +# RSpec Tests. They are included in this file because the local variables you are creating are not accessible across files. If we try to run these files as a separate file per normal operation, the local variable checks will return nil. + + +describe 'num1' do + it "is defined as a local variable" do + expect(defined?(num1)).to eq 'local-variable' + end + + it "is an integer" do + expect(num1).to be_a Fixnum + end +end + +describe 'num2' do + it "is defined as a local variable" do + expect(defined?(num2)).to eq 'local-variable' + end + + it "is an integer" do + expect(num2).to be_a Fixnum + end +end + +describe 'sum' do + it "is defined as a local variable" do + expect(defined?(sum)).to eq 'local-variable' + end + + it "is assigned the value of num1 + num2" do + expect(sum).to eq num1 + num2 + end +end + +describe 'difference' do + it "is defined as a local variable" do + expect(defined?(difference)).to eq 'local-variable' + end + + it "is assigned the value of num1 - num2" do + expect(difference).to eq num1 - num2 + end +end + +describe 'product' do + it "is defined as a local variable" do + expect(defined?(product)).to eq 'local-variable' + end + + it "is assigned the value of num1 * num2" do + expect(product).to eq num1 * num2 + end +end + +describe 'quotient' do + it "is defined as a local variable" do + expect(defined?(quotient)).to eq 'local-variable' + end + + it "is assigned the value of num1 / num2" do + expect(quotient).to eq num1.to_f / num2.to_f + end +end + +describe 'modulus' do + it "is defined as a local variable" do + expect(defined?(modulus)).to eq 'local-variable' + end + + it "is assigned the value of num1 % num2" do + expect(modulus).to eq num1.to_f % num2.to_f + end +end
Complete 4.2.3 - Basic Math
diff --git a/recipes/server-monitor.rb b/recipes/server-monitor.rb index abc1234..def5678 100644 --- a/recipes/server-monitor.rb +++ b/recipes/server-monitor.rb @@ -13,10 +13,7 @@ owner "root" group "root" mode "644" - variables( - :sd_url => node[:serverdensity][:sd_url], - :agent_key => node[:serverdensity][:agent_key] - ) + variables(node[:serverdensity]) notifies :restart, "service[sd-agent]" end
Use ALL THE ATTRIBUTES! (in the template)
diff --git a/week-4/longest-string/my_solution.rb b/week-4/longest-string/my_solution.rb index abc1234..def5678 100644 --- a/week-4/longest-string/my_solution.rb +++ b/week-4/longest-string/my_solution.rb @@ -13,6 +13,5 @@ # Your Solution Below def longest_string(list_of_words) - list_of_words.sort_by { |string| string.length } - return list_of_words[-1] + list_of_words.max_by { |string| string.length} end
Complete solution and spec files for longest string
diff --git a/spec/api_classes/artist_spec.rb b/spec/api_classes/artist_spec.rb index abc1234..def5678 100644 --- a/spec/api_classes/artist_spec.rb +++ b/spec/api_classes/artist_spec.rb @@ -2,10 +2,14 @@ describe LastFM::Artist do it "should define unrestricted methods" do - LastFM::Artist.unrestricted_methods.should == [:get_correction, :get_events, :get_images, :get_info, :get_past_events, :get_podcast, :get_shouts, :get_similar, :get_top_albums, :get_top_fans, :get_top_tags, :gettoptracks, :search] + LastFM::Artist.should respond_to( + :get_correction, :get_events, :get_images, :get_info, :get_past_events, + :get_podcast, :get_shouts, :get_similar, :get_top_albums, :get_top_fans, + :get_top_tags, :gettoptracks, :search + ) end - + it "should define restricted methods" do - LastFM::Artist.restricted_methods.should == [:add_tags, :get_tags, :remove_tag, :share, :shout] + LastFM::Artist.should respond_to(:add_tags, :get_tags, :remove_tag, :share, :shout) end end
Check restricted method definitions in Artist
diff --git a/code/black_jack_test.rb b/code/black_jack_test.rb index abc1234..def5678 100644 --- a/code/black_jack_test.rb +++ b/code/black_jack_test.rb @@ -0,0 +1,25 @@+require 'minitest/autorun' +#require 'minitest/pride' +require './black_jack' + +class TestBlackJack < MiniTest::Unit::TestCase + + def setup #this runs before each test + @black_jack = BlackJack.new + end + + def test_black_jack_exists + assert BlackJack.new + end + + def test_deck_exists + assert BlackJack.new.deck + end + +=begin + def test_black_jack_deck_has_cards + assert Game.new.grid.is_a? Array + assert_equal Game.new.grid.length, 3 + end +=end +end
Create test class, TestBlackJack which inherits from MiniTest::Unit::TestCase. Define methods for: setup, test_black_jack_exists, test_deck_exists
diff --git a/spec/lib/tinymce_spec.rb b/spec/lib/tinymce_spec.rb index abc1234..def5678 100644 --- a/spec/lib/tinymce_spec.rb +++ b/spec/lib/tinymce_spec.rb @@ -1,7 +1,22 @@ require 'spec_helper' describe TinyMCE do + before(:each) do + Rails.application.config.action_controller.asset_host = nil + ActionController::Base.config.relative_url_root = nil + end + it "has a base path" do TinyMCE.base.should eq("/assets/tinymce") end + + it "uses the asset host in the base path when set" do + Rails.application.config.action_controller.asset_host = "http://assets.example.com" + TinyMCE.base.should eq("http://assets.example.com/assets/tinymce") + end + + it "uses the relative url root in the base path when set" do + ActionController::Base.config.relative_url_root = "/subfolder" + TinyMCE.base.should eq("/subfolder/assets/tinymce") + end end
Add specs for asset hosts and relative url root
diff --git a/spec/models/role_spec.rb b/spec/models/role_spec.rb index abc1234..def5678 100644 --- a/spec/models/role_spec.rb +++ b/spec/models/role_spec.rb @@ -20,14 +20,14 @@ describe '.crop_wranglers' do let!(:crop_wranglers) { FactoryGirl.create_list(:crop_wrangling_member, 3) } it 'return the crop wranglers that are members of that role' do - expect(Role.crop_wranglers).to eq(crop_wranglers) + expect(Role.crop_wranglers).to match_array(crop_wranglers) end end describe '.admins' do let!(:admins) { FactoryGirl.create_list(:admin_member, 3) } it 'return the members that have the role of admin' do - expect(Role.admins).to eq(admins) + expect(Role.admins).to match_array(admins) end end end
Switch to match_array to get around spuriously failing tests
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index abc1234..def5678 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1,13 +1,13 @@ require 'rails_helper' RSpec.describe User, type: :model do - pending "add some examples to (or delete) #{__FILE__}" + #pending "add some examples to (or delete) #{__FILE__}" before :each do - @user = User.new(firstname: "John", lastname: "Kan", email: "john.kan@virtuosity.co.nz") + @user = User.new(first_name: "John", last_name: "Kan", email: "john.kan@virtuosity.co.nz") end describe '#new' do - it "takes firstname, lastname, email as parameters" do + it "takes first_name, last_name, email as parameters" do @user.should be_an_instance_of User end end
Add test for new User
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index abc1234..def5678 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1,5 +1,17 @@ require 'spec_helper' describe User do - pending "add some examples to (or delete) #{__FILE__}" + + it "is valid with a username and password" do + user = User.new( + name: 'Username', + password: 'Password', + password_confirmation: 'Password') + expect(user).to be_valid + end + + it "is invalid without a username" + it "is invalid without a password" + it "is invalid if it is a duplicate" + it "always has at least one admin user remaining" end
Test stubs for user model
diff --git a/app/controllers/assets_controller.rb b/app/controllers/assets_controller.rb index abc1234..def5678 100644 --- a/app/controllers/assets_controller.rb +++ b/app/controllers/assets_controller.rb @@ -12,8 +12,8 @@ } # Load and assign parent invoice - invoice = Invoice.find(params[:invoice_id]) - if invoice + if params[:invoice_id] + invoice = Invoice.find(params[:invoice_id]) asset_params.merge!( :title => invoice.title, :amount => invoice.amount
Fix Asset creation with no invoice.
diff --git a/app/controllers/events_controller.rb b/app/controllers/events_controller.rb index abc1234..def5678 100644 --- a/app/controllers/events_controller.rb +++ b/app/controllers/events_controller.rb @@ -6,7 +6,7 @@ # Only if logged in def create - @event = Event.new(params[:event]) + @event = Event.new(event_params) if @event.save redirect_to events_path(@event) else @@ -32,7 +32,7 @@ end private - # def event_params - # params.require(:event).permit(:start_date_time, :location) - # end + def event_params + params.require(:event).permit(:location, :start_date_time, :end_date_time) + end end
Add strong parameters in the events controller
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 @@ -6,7 +6,6 @@ else @keyword = params[:keyword] @results = Search.for(params[:keyword]) - @favorite = Favorite.new end end
Fix search controller remove favorite
diff --git a/Rakefile.rb b/Rakefile.rb index abc1234..def5678 100644 --- a/Rakefile.rb +++ b/Rakefile.rb @@ -25,6 +25,7 @@ nugets_pack :create_nugets => [package_dir, :versioning, :build] do |p| p.files = FileList['src/**/MiniWebDeploy.csproj'] p.out = package_dir + p.configuration = 'Release' p.exe = '.nuget/NuGet.exe' p.with_metadata do |m| m.description = 'A cool nuget'
Use the Release configuration when creating the nuget package
diff --git a/features/support/diff_lcs_versions.rb b/features/support/diff_lcs_versions.rb index abc1234..def5678 100644 --- a/features/support/diff_lcs_versions.rb +++ b/features/support/diff_lcs_versions.rb @@ -1,6 +1,8 @@+require 'diff-lcs' + Around "@skip-when-diff-lcs-1.4" do |scenario, block| if Diff::LCS::VERSION.to_f >= 1.4 - warn "Skipping scenario #{scenario.title} on #{Diff::LCS::VERSION.to_f}" + warn "Skipping scenario #{scenario.title} on `diff-lcs` v#{Diff::LCS::VERSION.to_f}" else block.call end @@ -8,7 +10,7 @@ Around "@skip-when-diff-lcs-1.3" do |scenario, block| if Diff::LCS::VERSION.to_f < 1.4 - warn "Skipping scenario #{scenario.title} on #{Diff::LCS::VERSION.to_f}" + warn "Skipping scenario #{scenario.title} on `diff-lcs` v#{Diff::LCS::VERSION.to_f}" else block.call end
Improve diff-lcs flags for cucumber
diff --git a/spec/classes/watchdog_spec.rb b/spec/classes/watchdog_spec.rb index abc1234..def5678 100644 --- a/spec/classes/watchdog_spec.rb +++ b/spec/classes/watchdog_spec.rb @@ -9,50 +9,36 @@ } end - it do - expect { subject }.to raise_error(/not supported on an Unsupported/) - end + it { expect { should compile }.to raise_error(/not supported on an Unsupported/) } end - context 'on RedHat', :compile do - let(:facts) do - { - :osfamily => 'RedHat' - } - end + on_supported_os.each do |os, facts| + context "on #{os}", :compile do + let(:facts) do + facts + end - it do - should contain_class('watchdog') - should contain_file('/etc/watchdog.conf') - should contain_package('watchdog') - should contain_service('watchdog').with( - 'ensure' => 'running', - 'enable' => true - ) - end - end + it { should contain_anchor('watchdog::begin') } + it { should contain_anchor('watchdog::end') } + it { should contain_class('watchdog') } + it { should contain_class('watchdog::config') } + it { should contain_class('watchdog::install') } + it { should contain_class('watchdog::params') } + it { should contain_class('watchdog::service') } - context 'on OpenBSD', :compile do - let(:facts) do - { - :osfamily => 'OpenBSD' - } - end - - it do - should contain_class('watchdog') - should contain_service('watchdogd').with( - 'ensure' => 'running', - 'enable' => true, - 'flags' => '-i 20 -p 60' - ) - should contain_sysctl('kern.watchdog.period').with( - 'ensure' => 'absent' - ) - should contain_sysctl('kern.watchdog.auto').with( + case facts[:osfamily] + when 'OpenBSD' + it { should contain_service('watchdogd').with_flags('-i 20 -p 60') } + it { should contain_sysctl('kern.watchdog.period').with_ensure('absent') } + it { should contain_sysctl('kern.watchdog.auto').with( 'ensure' => 'present', 'value' => 0 - ) + ) } + when 'RedHat' + it { should contain_file('/etc/watchdog.conf') } + it { should contain_package('watchdog') } + it { should contain_service('watchdog') } + end end end end
Update tests to use rspec-puppet-facts
diff --git a/SPTPersistentCache.podspec b/SPTPersistentCache.podspec index abc1234..def5678 100644 --- a/SPTPersistentCache.podspec +++ b/SPTPersistentCache.podspec @@ -13,10 +13,10 @@ s.ios.deployment_target = "7.0" s.osx.deployment_target = "10.8" - s.homepage = "https://github.com/spotify/SPTPersistentDataCache" + s.homepage = "https://github.com/spotify/SPTPersistentCache" s.license = "Apache 2.0" s.author = { "Dmitry Ponomarev" => "dmitry@spotify.com" } - s.source = { :git => "https://github.com/spotify/SPTPersistentDataCache.git", :tag => s.version } + s.source = { :git => "https://github.com/spotify/SPTPersistentCache.git", :tag => s.version } s.source_files = "include/SPTPersistentCache/*.h", "Sources/*.{h,m}" s.public_header_files = "include/SPTPersistentCache/*.h" s.xcconfig = { 'OTHER_LDFLAGS' => '-lObjC' }
Fix podspec referencing name with Data infix
diff --git a/guard_against_physical_delete.gemspec b/guard_against_physical_delete.gemspec index abc1234..def5678 100644 --- a/guard_against_physical_delete.gemspec +++ b/guard_against_physical_delete.gemspec @@ -18,7 +18,7 @@ s.rubygems_version = "1.8.15" s.summary = "Guard against physical delete" - s.add_runtime_dependency "activerecord", ">= 4.1.0", "< 5.1.0" + s.add_runtime_dependency "activerecord", ">= 5.0.0", "< 5.1.0" s.add_development_dependency "rake", "~> 13" s.add_development_dependency "rspec", "~> 3" s.add_development_dependency "sqlite3", "~> 1.3.6"
Drop support for activerecord <5.0
diff --git a/metadata.rb b/metadata.rb index abc1234..def5678 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs and configures Salt' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '0.1.2' +version '0.2.0' recipe 'master', 'Installs and configures a Salt master' recipe 'minion', 'Installs and configures a Salt minion'
Increment version to 0.2.0 in development
diff --git a/test/form/simple_form.rb b/test/form/simple_form.rb index abc1234..def5678 100644 --- a/test/form/simple_form.rb +++ b/test/form/simple_form.rb @@ -18,7 +18,7 @@ form.add(last_name) form.add(age) form.add(gender) - + form.add( PPCurses::ButtonPair.new('Submit', 'Cancel') ) app = PPCurses::Application.new
Create a button pair in the test.
diff --git a/test/html5/test_scrub.rb b/test/html5/test_scrub.rb index abc1234..def5678 100644 --- a/test/html5/test_scrub.rb +++ b/test/html5/test_scrub.rb @@ -0,0 +1,10 @@+require "helper" + +class UnitHTML5Scrub < Loofah::TestCase + include Loofah + + def test_scrub_css + assert Loofah::HTML5::Scrub.scrub_css("background: #ABC012"), "background: #ABC012" + assert Loofah::HTML5::Scrub.scrub_css("background: #abc012"), "background: #abc012" + end +end
Add a test for testing style attribute scrubbing
diff --git a/railties/lib/tasks/tmp.rake b/railties/lib/tasks/tmp.rake index abc1234..def5678 100644 --- a/railties/lib/tasks/tmp.rake +++ b/railties/lib/tasks/tmp.rake @@ -10,18 +10,24 @@ FileUtils.mkdir "tmp/sockets" end - desc "Clears all files in tmp/sessions" - task :clear_sessions do - FileUtils.rm(Dir['tmp/sessions/[^.]*']) + namespace :sessions do + desc "Clears all files in tmp/sessions" + task :clear do + FileUtils.rm(Dir['tmp/sessions/[^.]*']) + end end - desc "Clears all files and directories in tmp/cache" - task :clear_cache do - FileUtils.rm_rf(Dir['tmp/cache/[^.]*']) + namespace :cache do + desc "Clears all files and directories in tmp/cache" + task :clear do + FileUtils.rm_rf(Dir['tmp/cache/[^.]*']) + end end - desc "Clears all ruby_sess.* files in tmp/sessions" - task :clear_sockets do - FileUtils.rm(Dir['tmp/sockets/[^.]*']) + namespace :sockets do + desc "Clears all ruby_sess.* files in tmp/sessions" + task :clear do + FileUtils.rm(Dir['tmp/sockets/[^.]*']) + end end end
Make clearing follow the object:action naming of the rest of the tasks git-svn-id: afc9fed30c1a09d8801d1e4fbe6e01c29c67d11f@3698 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
diff --git a/recipes/update_tabula_rasa_cookbooks.rb b/recipes/update_tabula_rasa_cookbooks.rb index abc1234..def5678 100644 --- a/recipes/update_tabula_rasa_cookbooks.rb +++ b/recipes/update_tabula_rasa_cookbooks.rb @@ -9,4 +9,4 @@ end end -include_recipe "tabula_rasa::prapare_cookbooks" +include_recipe "tabula_rasa::prepare_cookbooks"
Fix typo in recipe name
diff --git a/lib/docs/scrapers/nginx_lua_module.rb b/lib/docs/scrapers/nginx_lua_module.rb index abc1234..def5678 100644 --- a/lib/docs/scrapers/nginx_lua_module.rb +++ b/lib/docs/scrapers/nginx_lua_module.rb @@ -2,8 +2,8 @@ class NginxLuaModule < Github self.name = 'nginx / Lua Module' self.slug = 'nginx_lua_module' - self.release = '0.10.0' - self.base_url = 'https://github.com/openresty/lua-nginx-module/tree/v0.10.0/' + self.release = '0.10.6' + self.base_url = "https://github.com/openresty/lua-nginx-module/tree/v#{self.release}/" html_filters.push 'nginx_lua_module/clean_html', 'nginx_lua_module/entries', 'title'
Update nginx / Lua Module documentation (0.10.6)
diff --git a/lib/font_awesome/sass/rails/engine.rb b/lib/font_awesome/sass/rails/engine.rb index abc1234..def5678 100644 --- a/lib/font_awesome/sass/rails/engine.rb +++ b/lib/font_awesome/sass/rails/engine.rb @@ -7,7 +7,7 @@ app.config.assets.paths << root.join('assets', sub) end - config.assets.precompile << /\.(?:svg|eot|woff|ttf)\z/ + app.config.assets.precompile << /\.(?:svg|eot|woff|ttf)\z/ end end end
Fix for missing app, for precompile
diff --git a/lib/lita/github_pr_list/check_list.rb b/lib/lita/github_pr_list/check_list.rb index abc1234..def5678 100644 --- a/lib/lita/github_pr_list/check_list.rb +++ b/lib/lita/github_pr_list/check_list.rb @@ -2,19 +2,18 @@ module GithubPrList class CheckList attr_accessor :request, :response, :payload, :redis, :repo_name, :comment_body, - :title, :id, :github_token, :github_client + :title, :id, :github_token, :github_client, :list def initialize(params = {}) self.github_token = params.fetch(:github_token, nil) self.response = params.fetch(:response, nil) self.request = params.fetch(:request, nil) self.redis = params.fetch(:redis, nil) + self.list = params.fetch(:list, "\n- [ ] Change log\n- [ ] Demo page\n- [ ] Product owner signoff\n") raise "invalid params in #{self.class.name}" if response.nil? || request.nil? || redis.nil? self.github_client = Octokit::Client.new(access_token: github_token, auto_paginate: true) - - list = "\n- [ ] Change log\n- [ ] Demo page\n- [ ] Product owner signoff\n" self.payload = JSON.parse(request.body.read) self.repo_name = payload["pull_request"]["head"]["repo"]["full_name"]
Change the list to be an attribute
diff --git a/govuk_message_queue_consumer.gemspec b/govuk_message_queue_consumer.gemspec index abc1234..def5678 100644 --- a/govuk_message_queue_consumer.gemspec +++ b/govuk_message_queue_consumer.gemspec @@ -19,7 +19,7 @@ s.add_dependency 'bunny', '~> 2.11' s.add_development_dependency 'rspec', '~> 3.8.0' - s.add_development_dependency 'rake', '~> 10.4.2' + s.add_development_dependency 'rake', '~> 12.3.2' s.add_development_dependency 'yard' s.add_development_dependency 'bunny-mock' s.add_development_dependency 'pry-byebug'
Update rake requirement from ~> 10.4.2 to ~> 12.3.2 Updates the requirements on [rake](https://github.com/ruby/rake) to permit the latest version. - [Release notes](https://github.com/ruby/rake/releases) - [Changelog](https://github.com/ruby/rake/blob/master/History.rdoc) - [Commits](https://github.com/ruby/rake/compare/v10.4.2...v12.3.2) Signed-off-by: dependabot[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@dependabot.com>
diff --git a/Casks/neteasemusic.rb b/Casks/neteasemusic.rb index abc1234..def5678 100644 --- a/Casks/neteasemusic.rb +++ b/Casks/neteasemusic.rb @@ -1,9 +1,9 @@ cask :v1 => 'neteasemusic' do - version '1.3.1' - sha256 '1a850e6c624d05e72d25caf6d449613713294ffd5fe4ddad4287684118a10fd6' + version '1.4.0' + sha256 'e617ccc626c2275638ee731af0dcfd955b327bb581b5b8b1caa91f69c055e3e1' # 126.net is the official download host per the vendor homepage - url "http://s1.music.126.net/download/osx/NeteaseMusic_#{version}_366_web.dmg" + url "http://s1.music.126.net/download/osx/NeteaseMusic_#{version}_392_web.dmg" name '网易云音乐' name 'NetEase cloud music' homepage 'http://music.163.com/#/download'
Upgrade Netease Music to v1.4.0
diff --git a/lib/test_launcher/cli/input_parser.rb b/lib/test_launcher/cli/input_parser.rb index abc1234..def5678 100644 --- a/lib/test_launcher/cli/input_parser.rb +++ b/lib/test_launcher/cli/input_parser.rb @@ -1,3 +1,4 @@+require "test_launcher/version" require "optparse" # This could use some love @@ -10,6 +11,8 @@ See full README: https://github.com/petekinnecom/test_launcher Usage: `test_launcher "search string" [--all]` + +VERSION: #{TestLauncher::VERSION} DESC @@ -54,6 +57,11 @@ exit end + opts.on("-v", "--version", "Display the version info") do + puts TestLauncher::VERSION + exit + end + opts.on("-f", "--framework framework", "The testing framework being used. Valid options: ['minitest', 'rspec', 'guess']. Defaults to 'guess'") do |framework| options[:framework] = framework end
Add version info to test_launcher
diff --git a/Casks/adobe-reader.rb b/Casks/adobe-reader.rb index abc1234..def5678 100644 --- a/Casks/adobe-reader.rb +++ b/Casks/adobe-reader.rb @@ -1,10 +1,10 @@ cask :v1 => 'adobe-reader' do - version '11.0.09' - sha256 '259957f1434bcdf47dc6a7c12affc40dd3c17288009dc229aa51f20ec4e8b1c5' + version '11.0.10' + sha256 '6aeb93bdd0da7662721e8a81493aef8bd5610d7386ac359bb35f089fbe0ee391' url "http://ardownload.adobe.com/pub/adobe/reader/mac/#{version.to_i}.x/#{version}/en_US/AdbeRdr#{version.gsub('.', '')}_en_US.dmg" homepage 'http://www.adobe.com/products/reader.html' - license :unknown # todo: change license and remove this comment; ':unknown' is a machine-generated placeholder + license :gratis pkg 'Adobe Reader XI Installer.pkg'
Update Adobe Reader to 11.0.10
diff --git a/test/integration/contract_test.rb b/test/integration/contract_test.rb index abc1234..def5678 100644 --- a/test/integration/contract_test.rb +++ b/test/integration/contract_test.rb @@ -0,0 +1,14 @@+# -*- coding: utf-8 -*- +require 'test_helper' + +class ContractTest < ActionDispatch::IntegrationTest + test "Contract index should be exist" do + get "/contracts" + assert_select 'section.keiyaku a[href]', count:1 + end + + test "Teikan should be exist" do + get "/contracts/teikan" + assert_response :success + end +end
Add test to index/show pages in Contract
diff --git a/Library/Formula/midnight-commander.rb b/Library/Formula/midnight-commander.rb index abc1234..def5678 100644 --- a/Library/Formula/midnight-commander.rb +++ b/Library/Formula/midnight-commander.rb @@ -1,26 +1,15 @@ require 'formula' class MidnightCommander <Formula - url 'http://www.midnight-commander.org/downloads/mc-4.7.5.tar.bz2' homepage 'http://www.midnight-commander.org/' sha256 '0d2b4e87b8a4158edf54380df9402b4a1a19f7494ef06dd0a0a3e3ff6a2b50f1' - head 'git://midnight-commander.org/git/mc.git', :using => :git, - # Ok, it's not a HEAD, but it works - :tag => '69d66dd5984357e37a0742c5e4d97c9f9f6305eb' depends_on 'pkg-config' => :build depends_on 'glib' depends_on 's-lang' def install - if ARGV.build_head? - ENV['LIBTOOLIZE'] = 'glibtoolize' - system 'mkdir m4' - system 'cp `brew --prefix`/share/aclocal/pkg.m4 ./m4' - system './autogen.sh' - system "cd po; for i in `ls | grep '[.]po$' | cut -d'.' -f1 | xargs`; do ./update.sh $i; done; cd .." - end system "./configure", "--disable-debug", "--disable-dependency-tracking", "--prefix=#{prefix}", "--without-x",
Revert "Modified formula for MC, it now supports --HEAD opt" This reverts commit 50bd66af99cfaec4501bd37b0938e18c93198a83.
diff --git a/ConventionalC.podspec b/ConventionalC.podspec index abc1234..def5678 100644 --- a/ConventionalC.podspec +++ b/ConventionalC.podspec @@ -5,8 +5,8 @@ s.homepage = "http://github.com/ConventionalC/ConventionalC" s.license = 'MIT' s.author = { "Peter DeWeese" => "peter@dewee.se" } - s.source = { :git => "https://github.com/ConventionalC/ConventionalC.git", :tag => "0.0.1" } - #s.source = { :git => "https://github.com/ConventionalC/ConventionalC.git", :branch => "develop" } + #s.source = { :git => "https://github.com/ConventionalC/ConventionalC.git", :tag => "0.0.1" } + s.source = { :git => "https://github.com/ConventionalC/ConventionalC.git", :branch => "develop" } s.requires_arc = true s.ios.source_files = 'ConventionalC-iOS', 'ConventionalC-Shared'
Set podspec for development mode.
diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb index abc1234..def5678 100644 --- a/config/initializers/session_store.rb +++ b/config/initializers/session_store.rb @@ -1,3 +1,6 @@ # Be sure to restart your server when you modify this file. -FinderFrontend::Application.config.session_store :cookie_store, key: "_finder-frontend_session", expire_after: 15.minutes +FinderFrontend::Application.config.session_store :cookie_store, + key: "_finder-frontend_session", + expire_after: 15.minutes, + secure: Rails.env.production?
Set 'secure' flag for session cookie in production This ensures that the session cookie isn't sent over HTTP. GOV.UK upgrades requests to HTTPS, so that won't happen normally.
diff --git a/db/migrate/20150827121444_add_fast_forward_option_to_project.rb b/db/migrate/20150827121444_add_fast_forward_option_to_project.rb index abc1234..def5678 100644 --- a/db/migrate/20150827121444_add_fast_forward_option_to_project.rb +++ b/db/migrate/20150827121444_add_fast_forward_option_to_project.rb @@ -8,7 +8,11 @@ disable_ddl_transaction! def up - add_column_with_default(:projects, :merge_requests_ff_only_enabled, :boolean, default: false) + # We put condition here because of a mistake we made a couple of years ago + # see https://gitlab.com/gitlab-org/gitlab-ce/issues/39382#note_45716103 + unless column_exists?(:projects, :merge_requests_ff_only_enabled) + add_column_with_default(:projects, :merge_requests_ff_only_enabled, :boolean, default: false) + end end def down
Put a condition to old migration that adds fast_forward column to MRs
diff --git a/db/migrate/20190222204716_remove_ip_tracking_from_publishers.rb b/db/migrate/20190222204716_remove_ip_tracking_from_publishers.rb index abc1234..def5678 100644 --- a/db/migrate/20190222204716_remove_ip_tracking_from_publishers.rb +++ b/db/migrate/20190222204716_remove_ip_tracking_from_publishers.rb @@ -1,6 +1,6 @@ class RemoveIpTrackingFromPublishers < ActiveRecord::Migration[5.2] def change - remove_column :publishers, :current_sign_in_ip - remove_column :publishers, :last_sign_in_ip + remove_column :publishers, :current_sign_in_ip, :inet + remove_column :publishers, :last_sign_in_ip, :inet end end
Add type to allow reverse of 20190222204716
diff --git a/webapp/spec/controllers/search_controller_spec.rb b/webapp/spec/controllers/search_controller_spec.rb index abc1234..def5678 100644 --- a/webapp/spec/controllers/search_controller_spec.rb +++ b/webapp/spec/controllers/search_controller_spec.rb @@ -21,13 +21,13 @@ end it "does not return sensitive diseases if the user doesn't have that privilege" do - get "cmrs", nil, {:user_id => @user.uid} + get "events", nil, {:user_id => @user.uid} assigns[:diseases].should == @diseases[0,1] end it "returns sensitive diseases if the user has that privilege" do @role.privileges << (Privilege.find_by_priv_name("access_sensitive_diseases") || Factory(:privilege, :priv_name => "access_sensitive_diseases")) - get "cmrs", nil, {:user_id => @user.uid} + get "events", nil, {:user_id => @user.uid} assigns[:diseases].should == @diseases end end
Revise commit f51bd10, fixes references to search/cmrs (again)
diff --git a/rswag-ui/lib/rswag/ui/basic_auth.rb b/rswag-ui/lib/rswag/ui/basic_auth.rb index abc1234..def5678 100644 --- a/rswag-ui/lib/rswag/ui/basic_auth.rb +++ b/rswag-ui/lib/rswag/ui/basic_auth.rb @@ -1,25 +1,34 @@+# frozen_string_literal: true + require 'rack/auth/basic' -class BasicAuth < ::Rack::Auth::Basic - def call(env) - return @app.call(env) unless env_matching_path +module Rswag + module Ui + # Extend Rack HTTP Basic Authentication, as per RFC 2617. + # @api private + # + class BasicAuth < ::Rack::Auth::Basic + def call(env) + return @app.call(env) unless env_matching_path - super(env) - end + super(env) + end - private + private - def env_matching_path - swagger_endpoints = Rswag::Ui.config.swagger_endpoints[:urls] - swagger_endpoints.find do |endpoint| - base_path = base_path(endpoint[:url]) - env_base_path = base_path(env['PATH_INFO']) + def env_matching_path + Rswag::Ui.config.swagger_endpoints[:urls].find do |endpoint| + base_path(endpoint[:url]) == env_base_path + end + end - base_path == env_base_path + def env_base_path + base_path(env['PATH_INFO']) + end + + def base_path(url) + url.downcase.split('/')[1] + end end end - - def base_path(url) - url.downcase.split('/')[1] - end end
fix(rswag-ui): Define BasicAuth in Rswag::Ui module
diff --git a/my_cookbooks/utils/recipes/default.rb b/my_cookbooks/utils/recipes/default.rb index abc1234..def5678 100644 --- a/my_cookbooks/utils/recipes/default.rb +++ b/my_cookbooks/utils/recipes/default.rb @@ -8,15 +8,21 @@ package 'tree' # Install MongoDB plugin for dstat -execute "wget -P /usr/share/dstat/ https://raw.github.com/gianpaj/dstat/master/plugins/dstat_mongodb_cmds.py" +execute 'install_dstat_with_mongodb_plugin' do + command 'wget -P /usr/share/dstat/ https://raw.github.com/gianpaj/dstat/master/plugins/dstat_mongodb_cmds.py' + not_if { FileTest.directory?('/usr/share/dstat/') } +end # Install MongoHacker -execute [ - 'wget -P /tmp https://github.com/TylerBrock/mongo-hacker/archive/master.zip', - 'unzip /tmp/master.zip -d /tmp/', - 'cd /tmp/mongo-hacker-master', - 'make', - 'ln mongo_hacker.js /home/ec2-user/.mongorc.js', - 'chown ec2-user: /home/ec2-user/.mongorc.js', - 'rm -rf /tmp/{mongo-hacker-master,master.zip}' -].join(' && ') +execute 'install_mongo_hacker' do + command [ + 'wget -P /tmp https://github.com/TylerBrock/mongo-hacker/archive/master.zip', + 'unzip /tmp/master.zip -d /tmp/', + 'cd /tmp/mongo-hacker-master', + 'make', + 'ln mongo_hacker.js /home/ec2-user/.mongorc.js', + 'chown ec2-user: /home/ec2-user/.mongorc.js', + 'rm -rf /tmp/{mongo-hacker-master,master.zip}' + ].join(' && ') + not_if { ::File.exists?('/home/ec2-user/.mongorc.js') } +end
Install dstat and MongoHacker only if not already present Just a small optimization when working iteratively on the cookbooks to make each `vagrant provision` run a bit faster.