diff
stringlengths 65
26.7k
| message
stringlengths 7
9.92k
|
|---|---|
diff --git a/features/support/env.rb b/features/support/env.rb
index abc1234..def5678 100644
--- a/features/support/env.rb
+++ b/features/support/env.rb
@@ -9,6 +9,7 @@ require 'rspec'
Capybara.app = Sinatra::Application
+Capybara.default_wait_time = 5
class RechargeWorld
include Capybara::DSL
|
Increase Capybara default wait time in hope to make Travis happy
|
diff --git a/spec/input_spec.rb b/spec/input_spec.rb
index abc1234..def5678 100644
--- a/spec/input_spec.rb
+++ b/spec/input_spec.rb
@@ -0,0 +1,49 @@+require File.expand_path 'watirspec/spec_helper', File.dirname(__FILE__)
+
+describe Watir::Input do
+
+ before do
+ browser.goto(WatirSpec.files + "/forms_with_input_elements.html")
+ end
+
+ describe "#to_checkbox" do
+ it "returns a CheckBox instance" do
+ pending
+ end
+
+ it "raises an error if the element is not a checkbox" do
+ pending
+ end
+ end
+
+ describe "#to_radio" do
+ it "returns a Radio instance" do
+ pending
+ end
+
+ it "raises an error if the element is not a radio button" do
+ pending
+ end
+ end
+
+ describe "#to_button" do
+ it "returns a Button instance" do
+ pending
+ end
+
+ it "raises an error if the element is not a button" do
+ pending
+ end
+ end
+
+ describe "#to_select" do
+ it "returns a Select instance" do
+ pending
+ end
+
+ it "raises an error if the element is not a select list" do
+ pending
+ end
+ end
+
+end
|
Add pending specs for our custom Input methods.
|
diff --git a/lib/import_resources.rb b/lib/import_resources.rb
index abc1234..def5678 100644
--- a/lib/import_resources.rb
+++ b/lib/import_resources.rb
@@ -17,12 +17,14 @@ resource.touch
end
- last_updated = DateTime.parse(Resource.order("updated_at desc").limit(1).first.updated_at.to_s)
+ if Resource.all.size > 0
+ last_updated = DateTime.parse(Resource.order("updated_at desc").limit(1).first.updated_at.to_s)
- Resource.where("updated_at < ?", last_updated).each do |resource|
- resource.update_attributes(
- :active => false
- )
+ Resource.where("updated_at < ?", last_updated).each do |resource|
+ resource.update_attributes(
+ :active => false
+ )
+ end
end
end
end
|
Fix for ImportResources if there are no Resources in Google Apps
Edge case, but this breaks the tests sometimes
|
diff --git a/lib/tasks/uploader.rake b/lib/tasks/uploader.rake
index abc1234..def5678 100644
--- a/lib/tasks/uploader.rake
+++ b/lib/tasks/uploader.rake
@@ -21,7 +21,7 @@ graph = GraphGenerator.generate_graph(domain)
domain_hash.merge!({ 'graph' => graph })
- HTTParty.post("#{args[:host]}/api/projects_domains/upload_model", {
+ HTTParty.post("#{args[:host]}/api/v1/projects_domains/upload_model", {
:body => domain_hash.to_json,
#:basic_auth => { :username => api_key },
:headers => { 'Content-Type' => 'application/json', 'Accept' => 'application/json'}
|
Add v1 to api path
|
diff --git a/app/helpers/sidebar_helper.rb b/app/helpers/sidebar_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/sidebar_helper.rb
+++ b/app/helpers/sidebar_helper.rb
@@ -10,7 +10,17 @@
def render_sidebar(sidebar)
if sidebar.view_root
- render_to_string(:file => "#{sidebar.view_root}/content.rhtml",
+ # Allow themes to override sidebar views
+ view_root = File.expand_path(sidebar.view_root)
+ rails_root = File.expand_path(RAILS_ROOT)
+ if view_root =~ /^#{Regexp.escape(rails_root)}/
+ new_root = view_root[rails_root.size..-1]
+ new_root.sub! %r{^/?vendor/}, ""
+ new_root.sub! %r{/views}, ""
+ new_root = File.join(this_blog.current_theme.path, "views", new_root)
+ view_root = new_root if File.exists?(File.join(new_root, "content.rhtml"))
+ end
+ render_to_string(:file => "#{view_root}/content.rhtml",
:locals => sidebar.to_locals_hash)
else
render_to_string(:partial => sidebar.content_partial,
|
Allow themes to once again override views for sidebars.
Note that the themes need to be updated. Instead of views/plugins/sidebars/archives/content.rhtml, use views/plugins/archives_sidebar/content.rhtml. The contents of the views may also need updating for sidebars
git-svn-id: 70ab0960c3db1cbf656efd6df54a8f3de72dc710@1263 820eb932-12ee-0310-9ca8-eeb645f39767
|
diff --git a/app/mailers/message_mailer.rb b/app/mailers/message_mailer.rb
index abc1234..def5678 100644
--- a/app/mailers/message_mailer.rb
+++ b/app/mailers/message_mailer.rb
@@ -8,6 +8,7 @@ #
# Returns nothing.
def created(message_id, recipient_id)
+
@message = Message.find(message_id)
@recipient = Person.find(recipient_id)
@message_markdown = markdown(@message.content)
@@ -24,12 +25,14 @@ to = Mail::Address.new(@recipient.email)
to.display_name = @recipient.name
- from = Mail::Address.new(
- "notifications@#{Helpful.incoming_email_domain}"
- )
+ from = Mail::Address.new("notifications@#{Helpful.incoming_email_domain}")
from.display_name = nickname(@message.person)
reply_to = @conversation.mailbox_email.dup
+
+ @message.attachments.each do |attachment|
+ attachments[File.basename(attachment.file.path)] = File.read(attachment.file.path)
+ end
mail to: to,
# FIXME: CC recipient instead
|
Enumerate and attach files to email
|
diff --git a/app/models/item/data_store.rb b/app/models/item/data_store.rb
index abc1234..def5678 100644
--- a/app/models/item/data_store.rb
+++ b/app/models/item/data_store.rb
@@ -0,0 +1,83 @@+# Defines how an Item's data is stored in its JSON data column. The format
+# varies depending on whether the data is localized, multivalued, both, or
+# neither. Coerces between these formats gracefully, since an Item's schema
+# definition may change over time.
+#
+# Note that in-memory the format is a Ruby Hash; ActiveRecord takes care of
+# serializing to JSON when it is saved to the database.
+#
+# Here are the formats:
+#
+# Single value, not localized
+# "key" => "value"
+#
+# Single value, localized
+# "key" => {
+# "_translations" => {
+# "en" => "english",
+# "it" => "italiano"
+# }
+# }
+#
+# Multivalued, not localized
+# "key" => ["one", "two"]
+#
+# Multivalued, localized
+# "key" => {
+# "_translations" => {
+# "en" => ["one", "two"],
+# "it" => ["uno", "due"]
+# }
+# }
+#
+class Item::DataStore
+ attr_reader :data, :key, :locale
+
+ def initialize(data:, key:, multivalued:, locale:)
+ @data = data || {}
+ @key = key.to_s
+ @multivalued = multivalued
+ @locale = locale ? locale.to_s : nil
+ end
+
+ def localized?
+ !locale.nil?
+ end
+
+ def multivalued?
+ @multivalued
+ end
+
+ def get
+ multivalued? ? all_in_locale : all_in_locale.first
+ end
+
+ def set(value)
+ data[key] = localized? ? merge_translation(value) : value
+ value
+ end
+
+ private
+
+ def all_in_locale
+ Array.wrap(translate(data[key]))
+ end
+
+ def translate(value)
+ translations = corerce_to_locale_hash(value)
+ localized? ? translations[locale] : translations.values.compact.first
+ end
+
+ def corerce_to_locale_hash(value)
+ if value.is_a?(Hash) && value.key?("_translations")
+ value["_translations"]
+ else
+ { locale => value }
+ end
+ end
+
+ def merge_translation(value)
+ existing = corerce_to_locale_hash(data[key])
+ { "_translations" => existing.merge(locale => value) }
+ end
+end
|
Define storage format for various data types
|
diff --git a/app/models/news_edition.rb b/app/models/news_edition.rb
index abc1234..def5678 100644
--- a/app/models/news_edition.rb
+++ b/app/models/news_edition.rb
@@ -1,16 +1,17 @@ require "edition"
class NewsEdition < Edition
+ include Attachable
field :subtitle, type: String
field :body, type: String
- field :home_image, type: String
- field :main_image, type: String
field :featured, type: Boolean
GOVSPEAK_FIELDS = Edition::GOVSPEAK_FIELDS + [:body]
@fields_to_clone = [:subtitle, :body, :home_image, :main_image]
+
+ attaches :image
def whole_body
body
|
Add image attachment to news item
|
diff --git a/spec/bitbucket_rest_api/request/oauth_spec.rb b/spec/bitbucket_rest_api/request/oauth_spec.rb
index abc1234..def5678 100644
--- a/spec/bitbucket_rest_api/request/oauth_spec.rb
+++ b/spec/bitbucket_rest_api/request/oauth_spec.rb
@@ -0,0 +1,27 @@+require 'spec_helper'
+require 'rack/test'
+
+describe BitBucket::Request::OAuth do
+ include Rack::Test::Methods
+
+
+ let(:app) { ->(env) { [200, env, "app"] } }
+
+ let (:middleware) { BitBucket::Request::OAuth.new(app) }
+
+ let(:request) { Rack::MockRequest.new(middleware) }
+
+ it "add url key to env hash with URI value" do
+ query_string = "key1=val1&key2=val2"
+ code, env = middleware.call Rack::MockRequest.env_for("/?#{query_string}", {method: :post})
+ expect(code).to eq 200
+ expect(env[:url].query).to eq query_string
+ end
+
+ it "creates a empty hash if query of URI is empty" do
+ code, env = middleware.call Rack::MockRequest.env_for("/", {method: :get})
+ expect(code).to eq 200
+ expect(middleware.query_params(env[:url])).to eq({})
+ end
+end
+
|
Add rspec for BitBucket::Request::OAuth middleware
|
diff --git a/spec/electric_sheep/shell/directories_spec.rb b/spec/electric_sheep/shell/directories_spec.rb
index abc1234..def5678 100644
--- a/spec/electric_sheep/shell/directories_spec.rb
+++ b/spec/electric_sheep/shell/directories_spec.rb
@@ -0,0 +1,34 @@+require 'spec_helper'
+
+describe ElectricSheep::Shell::Directories do
+ DirectoriesKlazz = Class.new do
+ include ElectricSheep::Shell::Directories
+
+ attr_reader :cmd, :host, :project
+
+ def initialize
+ @host, @project=Object.new, Object.new
+ end
+
+ def exec(cmd)
+ @cmd=cmd
+ end
+ end
+
+ describe DirectoriesKlazz do
+ before do
+ @subject=subject.new
+ ElectricSheep::Helpers::Directories.expects(:project_directory).
+ with(@subject.host, @subject.project).returns('/project/dir')
+ end
+
+ it 'returns the project directory' do
+ @subject.project_directory.must_equal '/project/dir'
+ end
+
+ it 'makes the directory and its parents' do
+ @subject.mk_project_directory!
+ @subject.cmd.must_equal 'mkdir -p /project/dir ; chmod 0700 /project/dir'
+ end
+ end
+end
|
Add missing spec of shell/directories module
|
diff --git a/core/dir/exists_spec.rb b/core/dir/exists_spec.rb
index abc1234..def5678 100644
--- a/core/dir/exists_spec.rb
+++ b/core/dir/exists_spec.rb
@@ -2,7 +2,7 @@ require File.expand_path('../fixtures/common', __FILE__)
require File.expand_path('../shared/exist', __FILE__)
-describe "Dir.exist?" do
+describe "Dir.exists?" do
before :all do
DirSpecs.create_mock_dirs
end
|
Fix name in the describe block of Dir.exists?.
|
diff --git a/spec/generators/clearance/specs/specs_generator_spec.rb b/spec/generators/clearance/specs/specs_generator_spec.rb
index abc1234..def5678 100644
--- a/spec/generators/clearance/specs/specs_generator_spec.rb
+++ b/spec/generators/clearance/specs/specs_generator_spec.rb
@@ -0,0 +1,26 @@+require "spec_helper"
+require "generators/clearance/specs/specs_generator"
+
+describe Clearance::Generators::SpecsGenerator, :generator do
+ it "copies specs to host app" do
+ run_generator
+
+ specs = %w(
+ factories/clearance
+ features/clearance/user_signs_out_spec
+ features/clearance/visitor_resets_password_spec
+ features/clearance/visitor_signs_in_spec
+ features/clearance/visitor_signs_up_spec
+ features/clearance/visitor_updates_password_spec
+ support/clearance
+ support/features/clearance_helpers
+ )
+
+ spec_files = specs.map { |spec| file("spec/#{spec}.rb") }
+
+ spec_files.each do |spec_file|
+ expect(spec_file).to exist
+ expect(spec_file).to have_correct_syntax
+ end
+ end
+end
|
Add tests for the specs generator
|
diff --git a/test/oauth_util_test.rb b/test/oauth_util_test.rb
index abc1234..def5678 100644
--- a/test/oauth_util_test.rb
+++ b/test/oauth_util_test.rb
@@ -5,7 +5,7 @@
class OauthUtilTest < Test::Unit::TestCase
def test_query_string_escapes_single_quote
- base_url = "http://example.com?location=d%27iberville"
+ base_url = "http://example.com?location=d'iberville"
o = OauthUtil.new
o.consumer_key = 'consumer_key'
|
Replace URL with unescaped version.
|
diff --git a/scripts/add_framework_script.rb b/scripts/add_framework_script.rb
index abc1234..def5678 100644
--- a/scripts/add_framework_script.rb
+++ b/scripts/add_framework_script.rb
@@ -0,0 +1,41 @@+#!/usr/bin/env ruby
+
+# Copyright 2019 Google
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+require 'xcodeproj'
+require 'set'
+sample = ARGV[0]
+target = ARGV[1]
+framework_dir = ARGV[2]
+project_path = "#{sample}Example.xcodeproj"
+project = Xcodeproj::Project.open(project_path)
+framework_group = Dir.glob(File.join(framework_dir ,"*framework"))
+
+
+project.targets.each do |project_target|
+ next unless project_target.name == target
+ project_framework_group = project.frameworks_group
+ framework_build_phase = project_target.frameworks_build_phase
+ framework_set = project_target.frameworks_build_phase.files.to_set
+ framework_group.each do |framework|
+ next if framework_set.size == framework_set.add(framework).size
+ ref = project_framework_group.new_reference("#{framework}")
+ ref.name = "#{File.basename(framework)}"
+ ref.source_tree = "SOURCE_ROOT"
+ puts ref
+ framework_build_phase.add_file_reference(ref)
+ end
+end
+project.save()
|
Add a tool to add framework automatically to a project.
|
diff --git a/test/translator_test.rb b/test/translator_test.rb
index abc1234..def5678 100644
--- a/test/translator_test.rb
+++ b/test/translator_test.rb
@@ -3,9 +3,13 @@ class Chelsy::TranslatorTest < Minitest::Test
include Chelsy
+ attr_reader :translator
+
+ def setup
+ @translator = Translator.new
+ end
+
def test_integer
- translator = Translator.new
-
i = Constant::Int.new(1)
assert_equal "1", translator.translate(i)
|
Initialize translator instance in setup hook.
|
diff --git a/attr_enum_accessor.gemspec b/attr_enum_accessor.gemspec
index abc1234..def5678 100644
--- a/attr_enum_accessor.gemspec
+++ b/attr_enum_accessor.gemspec
@@ -19,7 +19,7 @@
spec.required_ruby_version = ">= 1.9"
- spec.add_dependency "activesupport", "~> 3.2"
+ spec.add_dependency "activesupport", ">= 3.2"
spec.add_development_dependency "bundler", "~> 1.3"
spec.add_development_dependency "rake"
|
Add support for activesupport > 3
|
diff --git a/db/data_migration/20170822095423_convert_unknown_news_articles.rb b/db/data_migration/20170822095423_convert_unknown_news_articles.rb
index abc1234..def5678 100644
--- a/db/data_migration/20170822095423_convert_unknown_news_articles.rb
+++ b/db/data_migration/20170822095423_convert_unknown_news_articles.rb
@@ -0,0 +1,38 @@+begin
+ unknown_news_articles = NewsArticle.by_subtype(NewsArticleType::Unknown)
+ document_ids = unknown_news_articles.map { |n| n.document_id }.uniq
+ published_edition_ids = unknown_news_articles.published.map(&:id)
+
+ # We want to return ActiveRecord relations here, so that `update_all` works
+ press_releases = unknown_news_articles.joins(:document).where("documents.slug REGEXP ?", 'press-release')
+ news_story_ids = (unknown_news_articles - press_releases).map(&:id)
+ news_stories = NewsArticle.where(id: news_story_ids)
+
+ # Update NewsArticles in Whitehall
+ press_releases.update_all(news_article_type_id: NewsArticleType::PressRelease.id)
+ press_releases.where(minor_change: false, change_note: nil).update_all(change_note: "This news article was converted to a press release")
+
+ news_stories.update_all(news_article_type_id: NewsArticleType::NewsStory.id)
+ news_stories.where(minor_change: false, change_note: nil).update_all(change_note: "This news article was converted to a news story")
+
+ # Republish updated NewsArticles to PublishingAPI
+ puts "Updating PublishingAPI"
+ document_ids.each do |id|
+ PublishingApiDocumentRepublishingWorker.perform_async_in_queue("bulk_republishing", id)
+ print "."
+ end
+
+ # Update content in Rummager
+ puts "Updating Rummager"
+ published_editions = NewsArticle.find(published_edition_ids)
+ published_editions.each do |edition|
+ SearchIndexAddWorker.perform_async_in_queue(
+ "bulk_republishing",
+ edition.class.name,
+ edition.id
+ )
+ print "."
+ end
+rescue NameError => e
+ puts "Can't apply data migration: #{e.message}"
+end
|
Add data migration to convert NewsArticles
The NewsArticleType Unknown is a legacy concept. These are NewsArticles that were never categorised into one of the other NewsArticleTypes. These are surfaced on the frontend via the [Announcements page](www.gov.uk/government/announcements) and do get shown when filtering by PressRelease or NewsStory. Therefore it seems acceptable to convert these into the relevant types. This will enable us to remove the ‘Unknown’ NewsArticleType as well as some code that goes with this special case (in a future PR).
|
diff --git a/db/post_migrate/20170525140254_rename_all_reserved_paths_again.rb b/db/post_migrate/20170525140254_rename_all_reserved_paths_again.rb
index abc1234..def5678 100644
--- a/db/post_migrate/20170525140254_rename_all_reserved_paths_again.rb
+++ b/db/post_migrate/20170525140254_rename_all_reserved_paths_again.rb
@@ -0,0 +1,108 @@+# See http://doc.gitlab.com/ce/development/migration_style_guide.html
+# for more information on how to write migrations for GitLab.
+
+class RenameAllReservedPathsAgain < ActiveRecord::Migration
+ include Gitlab::Database::RenameReservedPathsMigration::V1
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ TOP_LEVEL_ROUTES = %w[
+ -
+ .well-known
+ abuse_reports
+ admin
+ all
+ api
+ assets
+ autocomplete
+ ci
+ dashboard
+ explore
+ files
+ groups
+ health_check
+ help
+ hooks
+ import
+ invites
+ issues
+ jwt
+ koding
+ member
+ merge_requests
+ new
+ notes
+ notification_settings
+ oauth
+ profile
+ projects
+ public
+ repository
+ robots.txt
+ s
+ search
+ sent_notifications
+ services
+ snippets
+ teams
+ u
+ unicorn_test
+ unsubscribes
+ uploads
+ users
+ ].freeze
+
+ PROJECT_WILDCARD_ROUTES = %w[
+ badges
+ blame
+ blob
+ builds
+ commits
+ create
+ create_dir
+ edit
+ environments/folders
+ files
+ find_file
+ gitlab-lfs/objects
+ info/lfs/objects
+ new
+ preview
+ raw
+ refs
+ tree
+ update
+ wikis
+ ].freeze
+
+ GROUP_ROUTES = %w[
+ activity
+ analytics
+ audit_events
+ avatar
+ edit
+ group_members
+ hooks
+ issues
+ labels
+ ldap
+ ldap_group_links
+ merge_requests
+ milestones
+ notification_setting
+ pipeline_quota
+ projects
+ subgroups
+ ].freeze
+
+ def up
+ rename_root_paths(TOP_LEVEL_ROUTES)
+ rename_wildcard_paths(PROJECT_WILDCARD_ROUTES)
+ rename_child_paths(GROUP_ROUTES)
+ end
+
+ def down
+ end
+end
|
Rename all forbidden paths again
|
diff --git a/spec/controllers/projects/graphs_controller_spec.rb b/spec/controllers/projects/graphs_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/projects/graphs_controller_spec.rb
+++ b/spec/controllers/projects/graphs_controller_spec.rb
@@ -12,10 +12,10 @@ describe 'GET #languages' do
let(:linguist_repository) do
double(languages: {
- 'Ruby' => 1000,
- 'CoffeeScript' => 350,
- 'PowerShell' => 15
- })
+ 'Ruby' => 1000,
+ 'CoffeeScript' => 350,
+ 'PowerShell' => 15
+ })
end
let(:expected_values) do
@@ -37,7 +37,7 @@ get(:languages, namespace_id: project.namespace.path, project_id: project.path, id: 'master')
expected_values.each do |val|
- expect(assigns(:languages)).to include(include(val))
+ expect(assigns(:languages)).to include(a_hash_including(val))
end
end
end
|
Fix indentation and change inner matcher
|
diff --git a/spec/models/article_spec.rb b/spec/models/article_spec.rb
index abc1234..def5678 100644
--- a/spec/models/article_spec.rb
+++ b/spec/models/article_spec.rb
@@ -17,10 +17,10 @@ it { should belong_to(:category) }
it { should have_many(:edits) }
- describe '#with_unapproved_edits' do
- it 'should return articles with unapproved edits' do
+ # describe '#with_unapproved_edits' do
+ # it 'should return articles with unapproved edits' do
- expect(true).to be false
- end
- end
+ # expect(true).to be false
+ # end
+ # end
end
|
Remove article test for unapproved_edits
|
diff --git a/spec/ubuntu/lx_boot_spec.rb b/spec/ubuntu/lx_boot_spec.rb
index abc1234..def5678 100644
--- a/spec/ubuntu/lx_boot_spec.rb
+++ b/spec/ubuntu/lx_boot_spec.rb
@@ -0,0 +1,36 @@+require 'spec_helper'
+
+# Testing for override files created by lx_boot
+
+# See https://github.com/joyent/illumos-joyent/blob/master/usr/src/lib/brand/lx/zone/lx_boot_zone_ubuntu.ksh
+
+## Dynamic overrides. Typically these are for network and DNS
+
+# DNS Resolvers
+describe file('/etc/resolvconf/resolv.conf.d/tail') do
+ it { should be_file }
+ it { should contain "# AUTOMATIC ZONE CONFIG" }
+end
+
+# Network interfaces
+describe file('/etc/network/interfaces.d/smartos') do
+ it { should be_file }
+ it { should contain "# AUTOMATIC ZONE CONFIG" }
+end
+
+## Static overrides
+
+describe file('/etc/init/console.override') do
+ it { should be_file }
+ it { should contain "CONTAINER=smartos" }
+end
+
+describe file('/etc/init/container-detect.override') do
+ it { should be_file }
+ its(:md5sum) { should eq 'dfd990f3a6ed9ed8582a3bae564551d9' }
+end
+
+describe file('/etc/init/mountall.override') do
+ it { should be_file }
+ its(:md5sum) { should eq '77e43ed540b051c9dc22df649eb7b597' }
+end
|
Test for files created by lx_boot_zone_ubuntu.ksh
|
diff --git a/extra_extra.gemspec b/extra_extra.gemspec
index abc1234..def5678 100644
--- a/extra_extra.gemspec
+++ b/extra_extra.gemspec
@@ -8,7 +8,7 @@ s.name = "extra_extra"
s.version = ExtraExtra::VERSION
s.authors = ["Stitch Fix Engineering"]
- s.email = ["eng@stitchfix.com"]
+ s.email = ["opensource@stitchfix.com"]
s.homepage = "http://tech.stitchfix.com"
s.summary = "Let your users read all about how awesome your app is!"
s.description = "Provides a simple way to include and manage release notes for internal applications by writing a markdown file"
|
Use Stitch Fix open source email
|
diff --git a/bencodr.gemspec b/bencodr.gemspec
index abc1234..def5678 100644
--- a/bencodr.gemspec
+++ b/bencodr.gemspec
@@ -13,6 +13,7 @@ s.description = "This gem provides a way to encode and decode bencode used by the Bit Torrent protocol. Normal ruby objects can be marshalled as bencode and demarshalled back to ruby."
s.required_rubygems_version = ">= 1.3.6"
+ s.add_development_dependency "rake"
s.add_development_dependency "rspec", "~> 2.8.0"
s.add_development_dependency "bundler", ">= 1.0.0"
s.add_development_dependency "fuubar", ">= 1.0.0"
|
Add rake to dev dependencies so travis will work
|
diff --git a/fpm-cookery.gemspec b/fpm-cookery.gemspec
index abc1234..def5678 100644
--- a/fpm-cookery.gemspec
+++ b/fpm-cookery.gemspec
@@ -18,10 +18,8 @@ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]
- s.add_development_dependency "fpm", "~> 0.4"
s.add_development_dependency "minitest", "~> 4.0"
s.add_development_dependency "rake"
- s.add_development_dependency "puppet"
s.add_runtime_dependency "fpm", "~> 0.4"
s.add_runtime_dependency "facter"
s.add_runtime_dependency "puppet"
|
Remove puppet and fpm from development dependencies.
They are already in runtime dependencies.
|
diff --git a/react-native-instabug-sdk.podspec b/react-native-instabug-sdk.podspec
index abc1234..def5678 100644
--- a/react-native-instabug-sdk.podspec
+++ b/react-native-instabug-sdk.podspec
@@ -13,7 +13,6 @@ s.source = { git: package.dig(:repository, :url) }
s.source_files = "ios/*.{h,m}"
s.platform = :ios, "8.0"
- s.frameworks = ["Instabug"]
s.dependency "Instabug", "5.3.2"
s.dependency "React"
|
Remove Instabug as a framework from the podspec
|
diff --git a/gollum-auth.gemspec b/gollum-auth.gemspec
index abc1234..def5678 100644
--- a/gollum-auth.gemspec
+++ b/gollum-auth.gemspec
@@ -21,6 +21,8 @@ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ['lib']
+ spec.add_dependency 'rack', '~> 1.6'
+
spec.add_development_dependency 'bundler', '~> 1.14'
spec.add_development_dependency 'rake', '~> 10.0'
spec.add_development_dependency 'rspec', '~> 3.0'
|
Add missing gem dependency for rack.
Gollum depends on sinatra which depends on rack ~> 1.4.
The latest version 1 of rack is 1.6.5 so we stick to 1.6.
|
diff --git a/api-versions.gemspec b/api-versions.gemspec
index abc1234..def5678 100644
--- a/api-versions.gemspec
+++ b/api-versions.gemspec
@@ -10,8 +10,6 @@ s.homepage = "https://github.com/EDMC/api-versions"
s.summary = "api-versions helps manage your Rails app API endpoints."
s.description = "api-versions helps manage your Rails app API endpoints."
-
- s.rubyforge_project = "api-versions"
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
Remove rubyforge link from gemspec
Rubyforge is sunsetted, see: https://twitter.com/evanphx/status/399552820380053505
|
diff --git a/lib/icims/job.rb b/lib/icims/job.rb
index abc1234..def5678 100644
--- a/lib/icims/job.rb
+++ b/lib/icims/job.rb
@@ -4,9 +4,9 @@
class Job < OpenStruct
+ DEFAULT_FIELDS = %w(id folder jobtitle positioncategory positiontype joblocation additionallocations overview)
+
class << self
-
- DEFAULT_FIELDS = %w(id folder jobtitle positioncategory positiontype joblocation additionallocations overview responsibilities)
def find job_id, fields: []
fields = DEFAULT_FIELDS unless fields.any?
|
Move DEFAULT_FIELDS out of class << self
|
diff --git a/app/models/tag.rb b/app/models/tag.rb
index abc1234..def5678 100644
--- a/app/models/tag.rb
+++ b/app/models/tag.rb
@@ -1,4 +1,7 @@ class Tag < ActiveRecord::Base
has_many :taggings, dependent: :destroy
has_many :posts, through: :taggings
+
+ has_many :interests, dependent: :destroy
+ has_many :followers, through: :interests, source: :follower
end
|
Add followers query method for Tag model
|
diff --git a/search/binary_search/ruby/binary_search.rb b/search/binary_search/ruby/binary_search.rb
index abc1234..def5678 100644
--- a/search/binary_search/ruby/binary_search.rb
+++ b/search/binary_search/ruby/binary_search.rb
@@ -0,0 +1,21 @@+def binary_search(array, num)
+ low = 0
+ high = array.size - 1
+
+ while low <= high
+ mid = (low + high) / 2
+
+ if (array[mid] == num)
+ return true
+ elsif array[mid] < num
+ low = mid + 1
+ else
+ high = mid - 1
+ end
+ end
+
+ return false
+end
+
+# test
+puts binary_search([4, 5, 9, 88, 104, 203, 501, 670], 5)
|
Add binary search in ruby
|
diff --git a/lib/fog/aws/requests/sts/get_federation_token.rb b/lib/fog/aws/requests/sts/get_federation_token.rb
index abc1234..def5678 100644
--- a/lib/fog/aws/requests/sts/get_federation_token.rb
+++ b/lib/fog/aws/requests/sts/get_federation_token.rb
@@ -4,6 +4,31 @@ class Real
require 'fog/aws/parsers/sts/get_session_token'
+
+ # Get federation token
+ #
+ # ==== Parameters
+ # * name<~String>: The name of the federated user.
+ # Minimum length of 2. Maximum length of 32.
+ # * policy<~String>: Optional policy that specifies the permissions
+ # that are granted to the federated user
+ # Minimum length of 1. Maximum length of 2048.
+ # * duration<~Integer>: Optional duration, in seconds, that the session
+ # should last.
+ # ==== Returns
+ # * response<~Excon::Response>:
+ # * body<~Hash>:
+ # * 'SessionToken'<~String> -
+ # * 'SecretAccessKey'<~String> -
+ # * 'Expiration'<~String> -
+ # * 'AccessKeyId'<~String> -
+ # * 'Arn'<~String> -
+ # * 'FederatedUserId'<~String> -
+ # * 'PackedPolicySize'<~String> -
+ # * 'RequestId'<~String> - Id of the request
+ #
+ # ==== See Also
+ # http://docs.aws.amazon.com/STS/latest/APIReference/API_GetFederationToken.html
def get_federation_token(name, policy, duration=43200)
request({
|
Add minimal documentation in GetFederationToken request
|
diff --git a/spec/models/institution_spec.rb b/spec/models/institution_spec.rb
index abc1234..def5678 100644
--- a/spec/models/institution_spec.rb
+++ b/spec/models/institution_spec.rb
@@ -0,0 +1,37 @@+require "rails_helper"
+
+describe Institution do
+ describe ".top" do
+ let(:petition){ FactoryGirl.create(:local_organizing_petition) }
+
+ let(:high_rank){ petition.action_page.institutions.create(name: "A") }
+ let(:mid_rank){ petition.action_page.institutions.create(name: "B") }
+ let(:low_rank){ petition.action_page.institutions.create(name: "C") }
+
+ before(:each) do
+ 100.times do
+ sig = FactoryGirl.create(:signature, petition_id: petition.id)
+ sig.affiliations.create(institution_id: high_rank.id)
+ end
+
+ 50.times do
+ sig = FactoryGirl.create(:signature, petition_id: petition.id)
+ sig.affiliations.create(institution_id: mid_rank.id)
+ end
+
+ 10.times do
+ sig = FactoryGirl.create(:signature, petition_id: petition.id)
+ sig.affiliations.create(institution_id: low_rank.id)
+ end
+ end
+
+ it "should return the top n institutions ordered by number of signatures" do
+ expect(petition.action_page.institutions.top(3).to_a).to eq([high_rank, mid_rank, low_rank])
+ end
+
+ it "should allow an argument which reorders a certain institution to the front" do
+ expect(petition.action_page.institutions.top(3, first: low_rank.id).to_a).to eq([low_rank, high_rank, mid_rank])
+ end
+ end
+end
+
|
Create spec for Institution.top scope
|
diff --git a/spec/rspec/expectations_spec.rb b/spec/rspec/expectations_spec.rb
index abc1234..def5678 100644
--- a/spec/rspec/expectations_spec.rb
+++ b/spec/rspec/expectations_spec.rb
@@ -1,11 +1,19 @@-require 'rspec/support/spec/prevent_load_time_warnings'
+require 'rspec/support/spec/library_wide_checks'
RSpec.describe "RSpec::Expectations" do
- it_behaves_like 'a library that issues no warnings when loaded', 'rspec-expectations',
- # We define minitest constants because rspec/expectations/minitest_integration
- # expects these constants to already be defined.
- 'module Minitest; class Assertion; end; module Test; end; end',
- 'require "rspec/expectations"'
+ it_behaves_like "library wide checks", "rspec-expectations",
+ :preamble_for_lib => [
+ # We define minitest constants because rspec/expectations/minitest_integration
+ # expects these constants to already be defined.
+ "module Minitest; class Assertion; end; module Test; end; end",
+ 'require "rspec/expectations"'
+ ],
+ :allowed_loaded_feature_regexps => [
+ /stringio/, /tempfile/, # Used by `output` matcher. Can't be easily avoided.
+ /delegate/, /tmpdir/, /thread/, # required by tempfile
+ /fileutils/, /etc/, # required by tmpdir
+ /prettyprint.rb/, /pp.rb/ # required by rspec-support
+ ]
it 'does not allow expectation failures to be caught by a bare rescue' do
expect {
|
Update to new rspec-support library-wide checks.
|
diff --git a/spec/ruby/core/main/def_spec.rb b/spec/ruby/core/main/def_spec.rb
index abc1234..def5678 100644
--- a/spec/ruby/core/main/def_spec.rb
+++ b/spec/ruby/core/main/def_spec.rb
@@ -1,14 +1,27 @@ require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../fixtures/classes', __FILE__)
+
+script_binding = binding
describe "main#def" do
after :each do
Object.send(:remove_method, :foo)
end
- it "sets the visibility of the given method to private" do
+ it "sets the visibility of the given method to private for TOPLEVEL_BINDING" do
eval "def foo; end", TOPLEVEL_BINDING
Object.should have_private_method(:foo)
end
+
+ it "sets the visibility of the given method to private for the script binding" do
+ eval "def foo; end", script_binding
+ Object.should have_private_method(:foo)
+ end
+
+ it "sets the visibility of the given method to private when defined in a block" do
+ eval "1.times { def foo; end }", script_binding
+ Object.should have_private_method(:foo)
+ end
+
end
|
Add specs for visibility of top level methods and script binding
|
diff --git a/spec/views/html_example_spec.rb b/spec/views/html_example_spec.rb
index abc1234..def5678 100644
--- a/spec/views/html_example_spec.rb
+++ b/spec/views/html_example_spec.rb
@@ -19,7 +19,7 @@ expect(html_example.filename).to eq("ordering_a_cup_of_coffee.html")
end
- describe "multi charctor example name" do
+ describe "multi-character example name" do
let(:metadata) { { :resource_name => "オーダ" } }
let(:label) { "Coffee / Teaが順番で並んでいること" }
let(:rspec_example) { group.example(label) {} }
|
Fix spelling in HtmlExample spec
|
diff --git a/lib/middleman-alias/alias-resource.rb b/lib/middleman-alias/alias-resource.rb
index abc1234..def5678 100644
--- a/lib/middleman-alias/alias-resource.rb
+++ b/lib/middleman-alias/alias-resource.rb
@@ -7,6 +7,10 @@ def initialize(store, path, alias_path)
@alias_path = alias_path
super(store, path)
+ end
+
+ def source_file
+ nil
end
def template?
|
Add the source_file method so that we don't break the sitemap area. /__middleman/sitemap/
|
diff --git a/lib/crunchbase-api/relation.rb b/lib/crunchbase-api/relation.rb
index abc1234..def5678 100644
--- a/lib/crunchbase-api/relation.rb
+++ b/lib/crunchbase-api/relation.rb
@@ -16,11 +16,6 @@ @type = data['type']
@name = data['name']
@path = data['path']
- @money_invested = data['money_invested'] unless data['money_invested'].nil?
- @money_invested_usd = data['money_invested_usd'] unless data['money_invested_usd'].nil?
- @money_raised_currency_code = data['money_invested_currency_code'] unless data['money_invested_currency_code'].nil?
- @investors = data['investors'] unless data['investors'].nil?
-
@created_at = Time.at(data['created_at']) unless data['created_at'].nil?
@updated_at = Time.at(data['updated_at']) unless data['updated_at'].nil?
end
|
Remove funding round specific properties from Relation
|
diff --git a/core/data/constants_spec.rb b/core/data/constants_spec.rb
index abc1234..def5678 100644
--- a/core/data/constants_spec.rb
+++ b/core/data/constants_spec.rb
@@ -0,0 +1,15 @@+require_relative '../../spec_helper'
+
+describe "Data" do
+ it "is a subclass of Object" do
+ suppress_warning do
+ Data.superclass.should == Object
+ end
+ end
+
+ ruby_version_is "2.5" do
+ it "is deprecated" do
+ -> { Data }.should complain(/constant ::Data is deprecated/)
+ end
+ end
+end
|
Add specs for the deprecated Data class
|
diff --git a/lib/priceable.rb b/lib/priceable.rb
index abc1234..def5678 100644
--- a/lib/priceable.rb
+++ b/lib/priceable.rb
@@ -18,7 +18,7 @@ end
end
- unless Rails::VERSION::MAJOR == 4
+ unless Rails::VERSION::MAJOR == 4 && !defined?(ProtectedAttributes)
if self._accessible_attributes?
attr_accessible *price_fields
end
|
Support for rails 4 protected_attributes gem
|
diff --git a/lib/newrelic_moped/instrumentation.rb b/lib/newrelic_moped/instrumentation.rb
index abc1234..def5678 100644
--- a/lib/newrelic_moped/instrumentation.rb
+++ b/lib/newrelic_moped/instrumentation.rb
@@ -12,7 +12,8 @@ executes do
Moped::Node.class_eval do
def process_with_newrelic_trace(operation, &callback)
- self.class.trace_execution_scoped(["Moped/Node/process"]) do
+ collection = operation.collection
+ self.class.trace_execution_scoped(["Moped::process[#{collection}]"]) do
t0 = Time.now
begin
|
Include collection name into metrics name
|
diff --git a/lib/rucaptcha.rb b/lib/rucaptcha.rb
index abc1234..def5678 100644
--- a/lib/rucaptcha.rb
+++ b/lib/rucaptcha.rb
@@ -35,5 +35,10 @@ end
end
-ActionController::Base.send(:include, RuCaptcha::ControllerHelpers)
-ActionView::Base.send(:include, RuCaptcha::ViewHelpers)
+ActiveSupport.on_load(:action_controller) do
+ ActionController::Base.send :include, RuCaptcha::ControllerHelpers
+end
+
+ActiveSupport.on_load(:active_view) do
+ include RuCaptcha::ViewHelpers
+end
|
Use `ActiveSupport.on_load` to extend ActionController and ActionView.
http://api.rubyonrails.org/classes/ActiveSupport/LazyLoadHooks.html
https://github.com/rails/rails/blob/92703a9ea5d8b96f30e0b706b801c9185ef14f0e/actionpack/lib/action_controller/base.rb#L264
https://github.com/rails/rails/blob/7da8d76206271bdf200ea201f7e5a49afb9bc9e7/actionview/lib/action_view/base.rb#L215
|
diff --git a/lib/rails-settings/cached_settings.rb b/lib/rails-settings/cached_settings.rb
index abc1234..def5678 100644
--- a/lib/rails-settings/cached_settings.rb
+++ b/lib/rails-settings/cached_settings.rb
@@ -21,8 +21,8 @@ end
def save_default(key, value)
- return false unless send(key).nil?
- send("#{key}=", value)
+ return false unless self[key].nil?
+ self[key] = value
end
end
end
|
Fix method name cannot be setting's key
|
diff --git a/lib/spec_support/check_all_columns.rb b/lib/spec_support/check_all_columns.rb
index abc1234..def5678 100644
--- a/lib/spec_support/check_all_columns.rb
+++ b/lib/spec_support/check_all_columns.rb
@@ -1,7 +1,5 @@ def check_all_columns(instance)
instance.class.columns.each do |column|
- it "has data in #{column.name} column" do
- instance.send(:"#{column.name}").should_not be_nil
- end
+ instance.send(:"#{column.name}").should_not be_nil
end
end
|
Remove the 'it' so 'it' can be placed higher up to catch interrupts
|
diff --git a/app/models/ability.rb b/app/models/ability.rb
index abc1234..def5678 100644
--- a/app/models/ability.rb
+++ b/app/models/ability.rb
@@ -5,6 +5,10 @@ user ||= User.new
can :update, Club, :user_id => user.id
+
+ can :read, Club do |club|
+ club.members.include?(user)
+ end
can [ :create, :edit, :update ], Course do |course|
course.user == user
|
Update the Ability Model for Club :read
Update the Ability model to handle restricting Club show actions based
on whether the member is currently a member of the Club.
|
diff --git a/lib/httplog/adapters/patron.rb b/lib/httplog/adapters/patron.rb
index abc1234..def5678 100644
--- a/lib/httplog/adapters/patron.rb
+++ b/lib/httplog/adapters/patron.rb
@@ -20,6 +20,16 @@ if log_enabled
headers = @response.headers
HttpLog.log_compact(action_name, url, @response.status, bm)
+ HttpLog.log_json(
+ method: action_name,
+ url: url,
+ request_body: options[:data],
+ request_headers: headers,
+ response_code: @response.status,
+ response_body: @response.body,
+ response_headers: headers,
+ benchmark: bm
+ )
HttpLog.log_status(@response.status)
HttpLog.log_benchmark(bm)
HttpLog.log_headers(headers)
|
Implement JSON logging for Patron
|
diff --git a/environment.rb b/environment.rb
index abc1234..def5678 100644
--- a/environment.rb
+++ b/environment.rb
@@ -12,7 +12,5 @@
DataMapper.setup(:default, ENV['DATABASE_URL'] || "sqlite3:///#{Dir.pwd}/development.sqlite3")
- if ENV['RACK_ENV'] == 'production'
- use Rack::GoogleAnalytics, :tracker => 'UA-21127535-1'
- end
+ use Rack::GoogleAnalytics, :tracker => 'UA-21127535-1'
end
|
Test for Heroku, unconditionally enabled Google Analytics
|
diff --git a/erbtex.gemspec b/erbtex.gemspec
index abc1234..def5678 100644
--- a/erbtex.gemspec
+++ b/erbtex.gemspec
@@ -23,5 +23,5 @@ s.require_paths = ["lib"]
s.add_dependency "erubis"
- s.add_development_dependency "rspec"
+ s.add_development_dependency "debugger"
end
|
Add debugger as development dependency.
|
diff --git a/capistrano-bundler.gemspec b/capistrano-bundler.gemspec
index abc1234..def5678 100644
--- a/capistrano-bundler.gemspec
+++ b/capistrano-bundler.gemspec
@@ -18,7 +18,6 @@ spec.require_paths = ['lib']
spec.add_dependency 'capistrano', '~> 3.1'
- spec.add_dependency 'sshkit', '~> 1.2'
spec.add_development_dependency 'bundler', '~> 1.3'
spec.add_development_dependency 'danger'
|
Remove sshkit runtime dependency declaration
Capistrano gem depends on sshkit itself.
|
diff --git a/spec/javascripts/support/jasmine_helper.rb b/spec/javascripts/support/jasmine_helper.rb
index abc1234..def5678 100644
--- a/spec/javascripts/support/jasmine_helper.rb
+++ b/spec/javascripts/support/jasmine_helper.rb
@@ -9,7 +9,6 @@ #end
#
#Example: prevent PhantomJS auto install, uses PhantomJS already on your path.
-#Jasmine.configure do |config|
-# config.prevent_phantom_js_auto_install = true
-#end
-#
+Jasmine.configure do |config|
+ config.prevent_phantom_js_auto_install = true
+end
|
Stop it all exploding on Travis
|
diff --git a/spec/javascripts/support/jasmine_helper.rb b/spec/javascripts/support/jasmine_helper.rb
index abc1234..def5678 100644
--- a/spec/javascripts/support/jasmine_helper.rb
+++ b/spec/javascripts/support/jasmine_helper.rb
@@ -14,7 +14,8 @@ # pin chromedriver version to latest compatible found
# see https://chromedriver.storage.googleapis.com/index.html
# Webdrivers.logger.level = :DEBUG
-Webdrivers::Chromedriver.required_version = '79.0.3945.36'
+# Webdrivers::Chromedriver.required_version = '81.0.4044.138' # may work locally too
+Webdrivers::Chromedriver.required_version = '71.0.3578.137'
Jasmine.configure do |config|
config.runner = lambda { |formatter, jasmine_server_url|
|
Downgrade chrome driver for jasmine
Inline with feature test chromedirver version
and version 79 may not work for some local test envs.
|
diff --git a/lib/storey/gen_dump_command.rb b/lib/storey/gen_dump_command.rb
index abc1234..def5678 100644
--- a/lib/storey/gen_dump_command.rb
+++ b/lib/storey/gen_dump_command.rb
@@ -1,39 +1,34 @@ module Storey
class GenDumpCommand
- easy_class_to_instance
-
- def initialize(options={})
- @options = options
- if @options[:database].blank?
+ def self.execute(options={})
+ if options[:database].blank?
raise ArgumentError, 'database must be supplied'
end
- end
- def execute
switches = {}
- switches['schema-only'] = nil if @options[:structure_only]
+ switches['schema-only'] = nil if options[:structure_only]
switches['no-privileges'] = nil
switches['no-owner'] = nil
- switches['host'] = @options[:host] if @options[:host].present?
- switches['username'] = @options[:username] if @options[:username].present?
- switches[:file] = Shellwords.escape(@options[:file])
+ switches['host'] = options[:host] if options[:host].present?
+ switches['username'] = options[:username] if options[:username].present?
+ switches[:file] = Shellwords.escape(options[:file])
- if @options[:schemas]
- schemas = @options[:schemas].split(',')
+ if options[:schemas]
+ schemas = options[:schemas].split(',')
schemas_switches = schemas.map do |part|
Utils.command_line_switches_from({schema: Shellwords.escape(part) })
end
end
command_parts = []
- if @options[:password].present?
- command_parts << "PGPASSWORD=#{@options[:password]}"
+ if options[:password].present?
+ command_parts << "PGPASSWORD=#{options[:password]}"
end
command_parts += ['pg_dump',
Utils.command_line_switches_from(switches),
schemas_switches,
- @options[:database]]
+ options[:database]]
command_parts.compact.join(' ')
end
|
Simplify GenDumpCommand to not use instances of itself
- Remove reliance on `easy_class_to_instance_method`
|
diff --git a/lib/validate_as_email/rspec.rb b/lib/validate_as_email/rspec.rb
index abc1234..def5678 100644
--- a/lib/validate_as_email/rspec.rb
+++ b/lib/validate_as_email/rspec.rb
@@ -1,4 +1,3 @@-require 'rspec/rails/extensions/active_record/base'
# Adds a custom matcher to RSpec to make it easier to make sure your email
# column is valid.
#
|
Remove one more instance of old requirement
|
diff --git a/lib/batch/arguments.rb b/lib/batch/arguments.rb
index abc1234..def5678 100644
--- a/lib/batch/arguments.rb
+++ b/lib/batch/arguments.rb
@@ -18,8 +18,8 @@
# Parse command-line arguments
def parse_arguments(args = ARGV)
- args_def.title ||= self.job_name.titleize
- args_def.purpose ||= self.job_desc
+ args_def.title ||= self.job.name.titleize
+ args_def.purpose ||= self.job.description
arg_parser = ArgParser::Parser.new(args_def)
@arguments = arg_parser.parse(args)
if @arguments == false
|
Fix argument configuration from job definition properties
|
diff --git a/resque-statsd-metrics.gemspec b/resque-statsd-metrics.gemspec
index abc1234..def5678 100644
--- a/resque-statsd-metrics.gemspec
+++ b/resque-statsd-metrics.gemspec
@@ -18,6 +18,7 @@ gem.require_paths = ["lib"]
gem.add_dependency("resque", "~> 1.13")
+ gem.add_dependency("statsd-ruby")
gem.add_development_dependency("minitest", "~> 5.0.4")
gem.add_development_dependency("rake")
gem.add_development_dependency("bundler")
|
Add statsd-ruby client to dependencies
|
diff --git a/app/controllers/articles_controller.rb b/app/controllers/articles_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/articles_controller.rb
+++ b/app/controllers/articles_controller.rb
@@ -1,5 +1,5 @@ class ArticlesController < ApplicationController
- before_filter :authenticate_user!, only: [:destroy]
+ before_filter :authenticate_user!, except: [:index]
def index
@articles = Article.search(params[:search])
@@ -31,13 +31,13 @@
def destroy
@article = find_article_by_params
- redirect_to articles_url if @article.destroy
+ redirect_to articles_url if @article.destroy
end
private
def article_params
- params.require(:article).permit(:title, :content)
+ params.require(:article).permit(:title, :content)
end
def find_article_by_params
|
Add authentication to everything except the index.
|
diff --git a/app/controllers/expenses_controller.rb b/app/controllers/expenses_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/expenses_controller.rb
+++ b/app/controllers/expenses_controller.rb
@@ -1,5 +1,4 @@ class ExpensesController < ApplicationController
-
def index
@expenses = Expense.all
end
@@ -26,6 +25,20 @@ @expense = Expense.find(params[:id])
end
+ def update
+ @expense = Expense.find(params[:id])
+ if @expense.update_attributes(expense_params)
+ redirect_to expenses_path
+ else
+ render 'edit'
+ end
+ end
+
+ def destroy
+ Expense.find(params[:id]).destroy
+ redirect_to expenses_path
+ end
+
private
def expense_params
|
Add missing update and destroy actions to expense controller
|
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
@@ -9,7 +9,7 @@ sign_in profile
redirect_to root_path
else
- flash[:error] = 'Invalid email/password combination' # Not quite right!
+ flash.now[:error] = 'Invalid email/password combination' # Not quite right!
render 'new'
end
end
|
Fix flash persisting after you've logged in
|
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,5 +1,5 @@ # -*- coding: utf-8 -*-
-class SessionsController < ApplicationController
+class SessionsController < CmsController
before_action :logged_in_user, only: [:destroy]
def create
|
Set CmsController as a parent of SessionsController
|
diff --git a/fixed_array.rb b/fixed_array.rb
index abc1234..def5678 100644
--- a/fixed_array.rb
+++ b/fixed_array.rb
@@ -14,7 +14,6 @@
def set(index, value)
instance_variable_set(name(index), value)
- value
end
private
|
Remove unnecessary line of code
|
diff --git a/lib/datatrans/xml/transaction/request.rb b/lib/datatrans/xml/transaction/request.rb
index abc1234..def5678 100644
--- a/lib/datatrans/xml/transaction/request.rb
+++ b/lib/datatrans/xml/transaction/request.rb
@@ -8,7 +8,7 @@
def post(url, options = {})
options = options.merge(self.datatrans.proxy)
- HTTParty.post(url, options)
+ HTTParty.post(url, **options)
end
def initialize(datatrans, params)
|
Fix argument delegation in Ruby 3
|
diff --git a/lib/fact_check_mail.rb b/lib/fact_check_mail.rb
index abc1234..def5678 100644
--- a/lib/fact_check_mail.rb
+++ b/lib/fact_check_mail.rb
@@ -10,7 +10,7 @@ end
def out_of_office?
- subject_is_out_of_office? or out_of_office_header_set?
+ subject_is_out_of_office? || out_of_office_header_set?
end
def method_missing(m, *args, &block)
|
Use correct boolean || operator
|
diff --git a/lib/firebolt/warmer.rb b/lib/firebolt/warmer.rb
index abc1234..def5678 100644
--- a/lib/firebolt/warmer.rb
+++ b/lib/firebolt/warmer.rb
@@ -28,7 +28,7 @@ end
def _warmer_reset_salt!
- ::Firebolt.reset_salt!(salt)
+ ::Firebolt.reset_salt!(_warmer_salt)
end
def _warmer_salt
@@ -44,7 +44,7 @@
results.each_pair do |key, value|
cache_key = _warmer_salted_cache_key(key)
- ::Firebolt.config.cache.write(cache_key, value, :expires_in => expires_in)
+ ::Firebolt.config.cache.write(cache_key, value, :expires_in => _warmer_expires_in)
end
end
end
|
Fix method calls where name was changed
|
diff --git a/lib/lita/rspec/matchers/route_matcher.rb b/lib/lita/rspec/matchers/route_matcher.rb
index abc1234..def5678 100644
--- a/lib/lita/rspec/matchers/route_matcher.rb
+++ b/lib/lita/rspec/matchers/route_matcher.rb
@@ -3,13 +3,14 @@ module Matchers
# Used to complete a chat routing test chain.
class RouteMatcher
- attr_accessor :expected_route
+ attr_accessor :context, :inverted, :message_body
+ attr_reader :expected_route
+ alias_method :inverted?, :inverted
def initialize(context, message_body, invert: false)
- @context = context
- @message_body = message_body
- @method = invert ? :not_to : :to
- @inverted = invert
+ self.context = context
+ self.message_body = message_body
+ self.inverted = invert
set_description
end
@@ -21,10 +22,10 @@ def to(route)
self.expected_route = route
- m = @method
- b = @message_body
+ m = method
+ b = message_body
- @context.instance_eval do
+ context.instance_eval do
allow(Authorization).to receive(:user_in_group?).and_return(true)
expect_any_instance_of(described_class).public_send(m, receive(route))
send_message(b)
@@ -46,12 +47,16 @@ set_description
end
- def inverted?
- defined?(@inverted) && @inverted
+ def method
+ if inverted?
+ :not_to
+ else
+ :to
+ end
end
def set_description
- description = %{#{description_prefix} "#{@message_body}"}
+ description = %{#{description_prefix} "#{message_body}"}
description << " to :#{expected_route}" if expected_route
::RSpec.current_example.metadata[:description] = description
end
|
Use accessor methods instead of instance variables.
|
diff --git a/lib/pagylight/active_record_extension.rb b/lib/pagylight/active_record_extension.rb
index abc1234..def5678 100644
--- a/lib/pagylight/active_record_extension.rb
+++ b/lib/pagylight/active_record_extension.rb
@@ -1,13 +1,16 @@ module Pagylight
module ActiveRecordExtension
+
#
# It'll give a simple interface like:
# Model.pagylight(10, 20)
# where firt parameter is page, and second is record per page
+ # Return first page if page supplied ins't available
#
def pagylight page, records
+ @_pages = count / records.to_i
@_page = page.to_i || 1
- @_pages = count / records.to_i
+ @_page = 1 unless [*1..@_pages].include? @_page
offset(@_page*records-records).limit(records)
end
@@ -23,7 +26,7 @@ #
def pages
return [*1..@_pages] if @_pages <= 10
- return [*1..8] + [@_pages] if @_page <= 5
+ return [*1..8] + [@_pages] if @_page <= 5
return [1] + [*(@_pages-7)..@_pages] if [*(@_pages-7)..@_pages].include? @_page
[1]+[*(@_page-3)..(@_page+3)]+[@_pages]
|
Return first page if page supplied inst available
|
diff --git a/lib/guard/go/runner.rb b/lib/guard/go/runner.rb
index abc1234..def5678 100644
--- a/lib/guard/go/runner.rb
+++ b/lib/guard/go/runner.rb
@@ -41,17 +41,24 @@ end
private
+
def run_go_command!
- if @options[:test]
- @proc = ChildProcess.build(@options[:cmd], "test")
- else
- if @options[:build_only]
- @proc = ChildProcess.build(@options[:cmd], "build")
- else
- @proc = ChildProcess.build(@options[:cmd], "run", @options[:server], @options[:args_to_s])
- end
- end
+ child_process_args = [@options[:cmd]]
+ child_process_args << "build" << @options[:server]
+ child_process_args[1..-1] = "test" if @options[:test]
+ @proc = ChildProcess.build *child_process_args
+ start_child_process!
+
+ return if @options[:build_only] || @options[:test]
+
+ @proc.wait
+ server_cmd = "./" + @options[:server].sub('.go', '')
+ @proc = ChildProcess.build server_cmd, options[:args_to_s]
+ start_child_process!
+ end
+
+ def start_child_process!
@proc.io.inherit!
@proc.cwd = Dir.pwd
@proc.start
|
Use 'go build' + ./binary instead of 'go run'
|
diff --git a/core/process/times_spec.rb b/core/process/times_spec.rb
index abc1234..def5678 100644
--- a/core/process/times_spec.rb
+++ b/core/process/times_spec.rb
@@ -16,12 +16,12 @@ ruby_version_is "2.5" do
platform_is_not :windows do
it "uses getrusage when available to improve precision beyond milliseconds" do
- times = 100.times.map { Process.clock_gettime(:GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID) }
+ times = 1000.times.map { Process.clock_gettime(:GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID) }
if times.count { |t| !('%.6f' % t).end_with?('000') } == 0
skip "getrusage is not supported on this environment"
end
- times = 100.times.map { Process.times }
+ times = 1000.times.map { Process.times }
times.count { |t| !('%.6f' % t.utime).end_with?('000') }.should > 0
times.count { |t| !('%.6f' % t.stime).end_with?('000') }.should > 0
end
|
Make more attempts to check for the precision of Process.times
* Process.clock_getres specs use 10_000 but that's quite slow for
the Process.times spec.
|
diff --git a/lib/tasks/gitlab/db/drop_all_tables.rake b/lib/tasks/gitlab/db/drop_all_tables.rake
index abc1234..def5678 100644
--- a/lib/tasks/gitlab/db/drop_all_tables.rake
+++ b/lib/tasks/gitlab/db/drop_all_tables.rake
@@ -0,0 +1,10 @@+namespace :gitlab do
+ namespace :db do
+ task drop_all_tables: :environment do
+ connection = ActiveRecord::Base.connection
+ connection.tables.each do |table|
+ connection.drop_table(table)
+ end
+ end
+ end
+end
|
Add a rake task that drops all tables
|
diff --git a/lib/transcoder/parser/yaml/identifier.rb b/lib/transcoder/parser/yaml/identifier.rb
index abc1234..def5678 100644
--- a/lib/transcoder/parser/yaml/identifier.rb
+++ b/lib/transcoder/parser/yaml/identifier.rb
@@ -3,12 +3,14 @@
module Transcoder
class Yaml < Parser
- identifier "text/yaml",
+ identifier "yaml",
+ "text/yaml",
"text/x-yaml",
"application/yaml",
"application/x-yaml"
def self.generate(objects)
+ raise TypeError unless objects.is_a? Hash or objects.is_a? Array
YAML.dump(objects)
end
|
Raise a TypeError if not a hash or an array
|
diff --git a/lib/identifiers/doi.rb b/lib/identifiers/doi.rb
index abc1234..def5678 100644
--- a/lib/identifiers/doi.rb
+++ b/lib/identifiers/doi.rb
@@ -20,7 +20,7 @@ |
[^[:space:]]+ # Suffix...
\([^[:space:])]+\) # Ending in balanced parentheses...
- (?![^[:space:]\p{P}]) # Not followed by more suffix or punctuation
+ (?![^[:space:]\p{P}]) # Not followed by more suffix
|
[^[:space:]]+(?![[:space:]])\p{^P} # Suffix ending in non-punctuation
)
|
Fix misleading comment on DOI regexp
The end of the match for DOIs ending in balanced parentheses does not
match punctuation (it's looking for something that is neither a space
nor punctuation) so correct the comment to be less misleading.
|
diff --git a/spec/features/admin/parts_spec.rb b/spec/features/admin/parts_spec.rb
index abc1234..def5678 100644
--- a/spec/features/admin/parts_spec.rb
+++ b/spec/features/admin/parts_spec.rb
@@ -3,8 +3,8 @@ describe "Parts", js: true do
stub_authorization!
- let(:tshirt) { create(:product, :name => "T-Shirt") }
- let(:mug) { create(:product, :name => "Mug") }
+ let!(:tshirt) { create(:product, :name => "T-Shirt") }
+ let!(:mug) { create(:product, :name => "Mug") }
before do
visit spree.admin_product_path(mug)
|
Fix parts spec by forcing variant creation
Avoid errors like:
Failure/Error: Unable to find matching line from backtrace
ActiveRecord::RecordNotFound:
Couldn't find Spree::Variant with id=1
|
diff --git a/spec/rollbar/delay/thread_spec.rb b/spec/rollbar/delay/thread_spec.rb
index abc1234..def5678 100644
--- a/spec/rollbar/delay/thread_spec.rb
+++ b/spec/rollbar/delay/thread_spec.rb
@@ -20,7 +20,7 @@ it 'doesnt raise any exception' do
expect do
described_class.call(payload).join
- end.not_to raise_exception(exception)
+ end.not_to raise_error(exception)
end
end
end
|
Use raise_error instead of raise_exception
|
diff --git a/spec/unit/mutant/ast/sexp_spec.rb b/spec/unit/mutant/ast/sexp_spec.rb
index abc1234..def5678 100644
--- a/spec/unit/mutant/ast/sexp_spec.rb
+++ b/spec/unit/mutant/ast/sexp_spec.rb
@@ -0,0 +1,36 @@+RSpec.describe Mutant::AST::Sexp do
+ let(:object) do
+ Class.new do
+ include Mutant::AST::Sexp
+
+ public :n_not
+ public :s
+ end.new
+ end
+
+ describe '#n_not' do
+ subject { object.n_not(node) }
+
+ let(:node) { s(:true) }
+
+ it 'returns negated ast' do
+ expect(subject).to eql(s(:send, s(:true), :!))
+ end
+ end
+
+ describe '#s' do
+ subject { object.s(*arguments) }
+
+ context 'with single argument' do
+ let(:arguments) { %i[foo] }
+
+ it { should eql(Parser::AST::Node.new(:foo)) }
+ end
+
+ context 'with single multiple arguments' do
+ let(:arguments) { %i[foo bar baz] }
+
+ it { should eql(Parser::AST::Node.new(:foo, %i[bar baz])) }
+ end
+ end
+end
|
Fix specification holes in Mutant::AST::Sexp
|
diff --git a/bin/find_spammers.rb b/bin/find_spammers.rb
index abc1234..def5678 100644
--- a/bin/find_spammers.rb
+++ b/bin/find_spammers.rb
@@ -0,0 +1,23 @@+def find_spammers
+ spammers = Set.new
+ User.all.each do |u|
+ puts "Checking user #{u.email}"
+ hp_last = ProjectHoneypot.lookup(u.last_sign_in_ip.to_s)
+ if hp_last.suspicious?
+ puts " Last IP suspicious: #{hp_last.ip_address}"
+ spammers << u
+ end
+
+ if u.last_sign_in_ip != u.current_sign_in_ip
+ hp_current = ProjectHoneypot.lookup(u.current_sign_in_ip.to_s)
+ if hp_current.suspicious?
+ puts " Current IP suspicious: #{hp_last.ip_address}"
+ spammers << u
+ end
+ end
+ end
+ puts "Found #{spammers.size} spammers"
+ spammers
+end
+
+find_spammers
|
Add script to check all users for spammers.
|
diff --git a/lib/salsa_supporter.rb b/lib/salsa_supporter.rb
index abc1234..def5678 100644
--- a/lib/salsa_supporter.rb
+++ b/lib/salsa_supporter.rb
@@ -1,5 +1,5 @@ class SalsaSupporter < SalsaObject
- salsa_attribute :organization_KEY, :Email, :First_Name, :Last_Name
+ salsa_attribute :organization_KEY, :Email, :First_Name, :Last_Name, :Phone,
salsa_attribute :Street, :Street_2
salsa_attribute :City, :State, :Country, :Zip
salsa_attribute :Organization, :Occupation
|
Add Phone to supporter data
|
diff --git a/lib/show_for/helper.rb b/lib/show_for/helper.rb
index abc1234..def5678 100644
--- a/lib/show_for/helper.rb
+++ b/lib/show_for/helper.rb
@@ -14,11 +14,9 @@
html_options[:id] ||= dom_id(object)
html_options[:class] = "show_for #{dom_class(object)} #{html_options[:class]}".strip
- builder_class = html_options.delete(:builder) || ShowFor::Builder
- content = with_output_buffer do
- yield builder_class.new(object, self)
- end
+ builder = html_options.delete(:builder) || ShowFor::Builder
+ content = capture(builder.new(object, self), &block)
content_tag(tag, content, html_options)
end
|
Use capture instead of with_output_buffer.
|
diff --git a/lib/tasks/gettext.rake b/lib/tasks/gettext.rake
index abc1234..def5678 100644
--- a/lib/tasks/gettext.rake
+++ b/lib/tasks/gettext.rake
@@ -6,12 +6,16 @@
desc "Create mo-files for L10n"
task :makemo do
+ require 'gettext'
+ require 'gettext/rails'
require 'gettext/utils'
GetText.create_mofiles(true, "po", "locale")
end
desc "Update pot/po files to match new version."
task :updatepo do
+ require 'gettext'
+ require 'gettext/rails'
require 'gettext/utils'
GetText::RubyParser::ID << '__'
GetText::RubyParser::PLURAL_ID << 'n__'
|
Load required libraries in updatepo task
|
diff --git a/lib/tty/test_prompt.rb b/lib/tty/test_prompt.rb
index abc1234..def5678 100644
--- a/lib/tty/test_prompt.rb
+++ b/lib/tty/test_prompt.rb
@@ -1,4 +1,6 @@ # frozen_string_literal: true
+
+require "stringio"
require_relative 'prompt'
|
Change to ensure dependency is loaded
|
diff --git a/threejs-rails.gemspec b/threejs-rails.gemspec
index abc1234..def5678 100644
--- a/threejs-rails.gemspec
+++ b/threejs-rails.gemspec
@@ -21,5 +21,5 @@ spec.add_development_dependency "bundler", "~> 1.7"
spec.add_development_dependency "rake", "~> 10.0"
- spec.add_runtime_dependency 'railties', '~> 3.0'
+ spec.add_runtime_dependency 'railties', '>= 3.0'
end
|
Change from spermy to gt or = for railties dependency
|
diff --git a/lib/clearance/engine.rb b/lib/clearance/engine.rb
index abc1234..def5678 100644
--- a/lib/clearance/engine.rb
+++ b/lib/clearance/engine.rb
@@ -23,10 +23,7 @@ app.config.filter_parameters += [:password, :token]
end
- config.app_middleware.insert_after(
- ActionDispatch::ParamsParser,
- Clearance::RackSession
- )
+ config.app_middleware.use(Clearance::RackSession)
config.to_prepare do
Clearance.configuration.reload_user_model
|
Add middleware at the bottom
Rails 5 eliminates the `ParamsParser` middleware. The Clearance
middleware itself seems to have no dependency on certain middleware
running after it.
|
diff --git a/lib/puppet/type/dism.rb b/lib/puppet/type/dism.rb
index abc1234..def5678 100644
--- a/lib/puppet/type/dism.rb
+++ b/lib/puppet/type/dism.rb
@@ -1,19 +1,7 @@ Puppet::Type.newtype(:dism) do
@doc = 'Manages Windows features via dism.'
- ensurable do
- desc 'Windows feature install state.'
-
- defaultvalues
-
- newvalue(:present) do
- provider.create
- end
-
- newvalue(:absent) do
- provider.destroy
- end
- end
+ ensurable
newparam(:name, :namevar => true) do
desc 'The Windows feature name (case-sensitive).'
|
Fix ensurable so it works with PE 2015.2, tested as working on 3.8 as well
|
diff --git a/lib/rack_after_reply.rb b/lib/rack_after_reply.rb
index abc1234..def5678 100644
--- a/lib/rack_after_reply.rb
+++ b/lib/rack_after_reply.rb
@@ -37,3 +37,16 @@ end
RackAfterReply.apply
+
+# The web server library may not be loaded until we've instantiated the Rack
+# handler (e.g., Rails 3.0's console command when no server argument is given),
+# so call apply once we know that has happened too.
+Rack::Server.class_eval do
+ def server_with_rack_after_reply
+ result = server_without_rack_after_reply
+ RackAfterReply.apply
+ result
+ end
+
+ RackAfterReply.freedom_patch(self, :server)
+end
|
Handle RackAfterReply being loaded before web server library.
|
diff --git a/features/support/env.rb b/features/support/env.rb
index abc1234..def5678 100644
--- a/features/support/env.rb
+++ b/features/support/env.rb
@@ -18,7 +18,7 @@
$: << File.join(File.dirname(__FILE__), '..', '..', 'lib')
-require 'spec/expectations'
+require 'rspec/expectations'
require 'mixlib/log'
require 'tmpdir'
require 'stringio'
|
Fix obsolete require statement for rspec
(The old one brakes with RSpec 2.*)
|
diff --git a/features/support/vcr.rb b/features/support/vcr.rb
index abc1234..def5678 100644
--- a/features/support/vcr.rb
+++ b/features/support/vcr.rb
@@ -1,7 +1,5 @@ require 'vcr'
require 'webmock/cucumber'
-
-WebMock.disable_net_connect!(:allow => 'lon.auth.api.rackspacecloud.com')
VCR.configure do |c|
# Automatically filter all secure details that are stored in the environment
@@ -16,6 +14,7 @@ c.cassette_library_dir = 'fixtures/vcr_cassettes'
c.hook_into :webmock
c.ignore_localhost = true
+ c.ignore_hosts 'lon.auth.api.rackspacecloud.com'
c.ignore_request do |request|
URI(request.uri).host =~ %r{.*\.clouddrive\.com.*}
end
|
Revert "Allow rackspace connections further up the chain"
This reverts commit ccf5271bf223b6c6ab97b13b6fedb24295fddc23.
|
diff --git a/filtered_params.gemspec b/filtered_params.gemspec
index abc1234..def5678 100644
--- a/filtered_params.gemspec
+++ b/filtered_params.gemspec
@@ -30,7 +30,7 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ['lib']
- spec.add_dependency 'activesupport', '~> 4.0.0.rc2'
+ spec.add_dependency 'activesupport', '~> 4.0'
spec.add_development_dependency 'bundler', '~> 1.3'
spec.add_development_dependency 'rake'
|
Change the version of ActiveSupport from rc to rel.
|
diff --git a/tasks/gem.rake b/tasks/gem.rake
index abc1234..def5678 100644
--- a/tasks/gem.rake
+++ b/tasks/gem.rake
@@ -15,7 +15,7 @@
self.readme_file = 'README.rdoc'
self.history_file = 'CHANGELOG.rdoc'
- self.extra_rdoc_files = FileList['*.rdoc']
+ self.extra_rdoc_files = FileList['*.rdoc', 'ext/**/*.c']
spec_extras[:required_ruby_version] = Gem::Requirement.new('>= 1.8.6')
spec_extras[:required_rubygems_version] = '>= 1.3.5'
|
Document C code now (pretty much documented)
Thanks to tenderlove (Aaron Patterson) for that!
|
diff --git a/test/helper.rb b/test/helper.rb
index abc1234..def5678 100644
--- a/test/helper.rb
+++ b/test/helper.rb
@@ -5,10 +5,10 @@ require 'coveralls'
SimpleCov.start do
- self.formatter = SimpleCov::Formatter::MultiFormatter[
+ self.formatter = SimpleCov::Formatter::MultiFormatter.new([
SimpleCov::Formatter::HTMLFormatter,
Coveralls::SimpleCov::Formatter
- ]
+ ])
# Exclude the testsuite itself.
add_filter "/test/"
|
Fix a deprecation warning of simpleCov
`SimpleCov::Formatter::MultiFormatter[]` is deprecated.
So, this PR replaces it with `.new`.
See https://github.com/colszowka/simplecov/blob/cb0e62b37b63816d07bdb15f3ee88ceade0947e5/lib/simplecov/formatter/multi_formatter.rb#L27
|
diff --git a/lib/web_console/view.rb b/lib/web_console/view.rb
index abc1234..def5678 100644
--- a/lib/web_console/view.rb
+++ b/lib/web_console/view.rb
@@ -25,9 +25,13 @@ render(template: template, layout: 'layouts/inlined_string')
end
- # Escaped alias for "ActionView::Helpers::TranslationHelper.t".
+ # Override method for ActionView::Helpers::TranslationHelper#t.
+ #
+ # This method escapes the original return value for JavaScript, since the
+ # method returns a HTML tag with some attributes when the key is not found,
+ # so it could cause a syntax error if we use the value in the string literals.
def t(key, options = {})
- super.gsub("\n", "\\n")
+ j super
end
end
end
|
Use j() for i18n translating text
|
diff --git a/language/versions/retry_1.8.rb b/language/versions/retry_1.8.rb
index abc1234..def5678 100644
--- a/language/versions/retry_1.8.rb
+++ b/language/versions/retry_1.8.rb
@@ -6,7 +6,7 @@ end
# block retry has been officially deprecated by matz and is unsupported in 1.9
- not_compliant_on :rubinius do
+ not_compliant_on :rubinius, :jruby do
it "re-executes the entire enumeration" do
list = []
[1,2,3].each do |x|
@@ -17,4 +17,4 @@ list.should == [1,2,3,1,2,3]
end
end
-end+end
|
Add not_compliant_on for retry in block on jruby.
|
diff --git a/rfid.rb b/rfid.rb
index abc1234..def5678 100644
--- a/rfid.rb
+++ b/rfid.rb
@@ -1,5 +1,16 @@ require 'revdev'
require 'pry'
+require "optparse"
+
+USAGE=<<__EOF
+usage:
+ ruby #{$0} event_device output_file
+
+ read from event_device and output to file
+
+example:
+ #{$0} /dev/input/event5 /var/www/nginx/serve/file.txt
+__EOF
LEFT_SHIFT = 42
ENTER = 28
@@ -41,11 +52,17 @@
def main
include Revdev
+ STDOUT.sync = true
- evdev = EventDevice.new('/dev/input/event22')
+ if ARGV.length == 0
+ puts USAGE
+ exit false
+ end
+
+ evdev = EventDevice.new(ARGV[0])
evdev.grab
- file = File.open('checkpoint_0.txt','at')
+ file = File.open(ARGV[1],'at')
file.sync = true
trap "INT" do
|
Make the script work with arguments
|
diff --git a/spec/models/concerns/user/completeness_spec.rb b/spec/models/concerns/user/completeness_spec.rb
index abc1234..def5678 100644
--- a/spec/models/concerns/user/completeness_spec.rb
+++ b/spec/models/concerns/user/completeness_spec.rb
@@ -21,7 +21,7 @@ end
context 'when the profile type is channel' do
- let(:user) { create(:channel, name: 'Some Channel', description: 'Some other text here', user: create(:user, other_url: nil, address: 'Kansas City, MO', profile_type: 'channel')).user }
+ let(:user) { create(:channel, name: 'Some Channel', description: 'Some other text here', user: create(:user, name: nil, other_url: nil, address: 'Kansas City, MO', profile_type: 'channel')).user.reload }
it 'completeness progress should be 42' do
expect(subject).to eq 42
|
Fix spec completeness user concern spec
|
diff --git a/spec/cucumber/web_spec.rb b/spec/cucumber/web_spec.rb
index abc1234..def5678 100644
--- a/spec/cucumber/web_spec.rb
+++ b/spec/cucumber/web_spec.rb
@@ -1,4 +1,15 @@ require 'spec_helper'
describe Cucumber::Web do
+ it 'extends paths' do
+ subject.should be_a(Cucumber::Web::Paths)
+ end
+
+ it 'extends selectors' do
+ subject.should be_a(Cucumber::Web::Selectors)
+ end
+
+ it 'extends steps' do
+ subject.should be_a(Cucumber::Web::Steps)
+ end
end
|
Test that the Cucumber::Web module extends paths, selectors and steps
|
diff --git a/hatenablog.gemspec b/hatenablog.gemspec
index abc1234..def5678 100644
--- a/hatenablog.gemspec
+++ b/hatenablog.gemspec
@@ -21,6 +21,9 @@
spec.add_development_dependency "bundler", "~> 1.10"
spec.add_development_dependency "rake", "~> 10.0"
+ spec.add_development_dependency "rr"
+ spec.add_development_dependency "test-unit"
+ spec.add_development_dependency "test-unit-rr"
spec.add_dependency "oauth"
end
|
Add development dependencies to gemspec
|
diff --git a/FDTake.podspec b/FDTake.podspec
index abc1234..def5678 100644
--- a/FDTake.podspec
+++ b/FDTake.podspec
@@ -13,7 +13,7 @@ s.social_media_url = 'https://twitter.com/fulldecent'
s.platform = :ios, '8.0'
s.requires_arc = true
- s.dependency "Asivura-CTAssetsPickerController"
+ s.dependency "CTAssetsPickerController"
s.source_files = 'Pod/Classes/**/*'
s.resource_bundles = {
'FDTake' => ['Pod/*.lproj']
|
Update name of pod dep to match name given in the fork
|
diff --git a/config/initializers/resque.rb b/config/initializers/resque.rb
index abc1234..def5678 100644
--- a/config/initializers/resque.rb
+++ b/config/initializers/resque.rb
@@ -0,0 +1,5 @@+rails_root = ENV['RAILS_ROOT'] || File.dirname(__FILE__) + '/../..'
+rails_env = ENV['RAILS_ENV'] || 'development'
+
+resque_config = YAML.load_file(rails_root + '/config/resque.yml')
+Resque.redis = resque_config[rails_env]
|
Add initializer for production config
|
diff --git a/smoke_test/steps/base_step.rb b/smoke_test/steps/base_step.rb
index abc1234..def5678 100644
--- a/smoke_test/steps/base_step.rb
+++ b/smoke_test/steps/base_step.rb
@@ -27,6 +27,19 @@ def mail_lookup
MailLookup.new(state[:started_at])
end
+
+ def with_retries(attempts: 5, initial_delay: 2, max_delay: 30)
+ delay = initial_delay
+ result = nil
+ attempts.times do
+ result = yield
+ break if result
+ puts "waiting #{delay}s .."
+ sleep delay
+ delay = [max_delay, delay * 2].min
+ end
+ result
+ end
end
end
end
|
Add ability to perform a task with retries
|
diff --git a/spec/controllers/api/v1/tasks_controller_spec.rb b/spec/controllers/api/v1/tasks_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/api/v1/tasks_controller_spec.rb
+++ b/spec/controllers/api/v1/tasks_controller_spec.rb
@@ -53,6 +53,11 @@ expect( response_body_object.send k ).to eq v
end
end
+
+ it 'success even if attribute not on permitted params' do
+ put :update, id: task.id, task: task_attr.merge({ invalid: 'invalid' })
+ expect( response ).to be_success
+ end
end
end #logged in user context
end
|
Test for non attribute params on put
|
diff --git a/spec/features/creating_posts_validations_spec.rb b/spec/features/creating_posts_validations_spec.rb
index abc1234..def5678 100644
--- a/spec/features/creating_posts_validations_spec.rb
+++ b/spec/features/creating_posts_validations_spec.rb
@@ -13,10 +13,10 @@
char = 'a'
- it "Doesn't save posts with more than 21 characters " do
- attempt_to_post_with title: (char *22)
+ it "Doesn't save posts with more than 25 characters " do
+ attempt_to_post_with title: (char *26)
attempt_to_post_with content: (char *15)
- expect(page).not_to have_content (char *22)
+ expect(page).not_to have_content (char *26)
end
it "Does save posts with vaild title and content" do
|
Update createing post spec with new validations/passing
|
diff --git a/lib/active_admin/globalize3/index_table_for_extension.rb b/lib/active_admin/globalize3/index_table_for_extension.rb
index abc1234..def5678 100644
--- a/lib/active_admin/globalize3/index_table_for_extension.rb
+++ b/lib/active_admin/globalize3/index_table_for_extension.rb
@@ -6,7 +6,7 @@ def translation_status
column I18n.t("active_admin.globalize3.translations") do |obj|
obj.translation_names.map do |t|
- '<span class="status_tag">%s</span>' % t
+ ActiveAdmin::Views::StatusTag.new.status_tag(t,:ok,:label => t)
end.join(" ").html_safe
end
end
|
Use the active admin method for this
|
diff --git a/spec/acceptance/users_spec.rb b/spec/acceptance/users_spec.rb
index abc1234..def5678 100644
--- a/spec/acceptance/users_spec.rb
+++ b/spec/acceptance/users_spec.rb
@@ -1,3 +1,4 @@+# encoding: UTF-8
require File.expand_path(File.dirname(__FILE__) + '/acceptance_helper')
feature 'Users' do
|
Add magic encoding comment for Ruby 1.9
Required due to "»" character in spec example.
|
diff --git a/spec/driver_interface_spec.rb b/spec/driver_interface_spec.rb
index abc1234..def5678 100644
--- a/spec/driver_interface_spec.rb
+++ b/spec/driver_interface_spec.rb
@@ -4,45 +4,28 @@ describe EventStore do
before(:each) { prepare_for_test }
context "interface structure" do
- let(:subject) {event_store}
- it "should respond to save_events" do
- subject.should respond_to("save_events")
- end
+ let(:subject) { event_store }
+ methods = [
+ :save_events,
+ :save_snapshot,
+ :get_aggregate_events_from_snapshot,
+ :get_aggregate,
+ :get_aggregate_events,
+ :get_aggregate_ids,
+ :get_all_types,
+ :get_snapshot,
+ :get_events,
+ :url,
+ :context,
+ :driver
+ ]
- it "should respond to save_snapshot" do
- subject.should respond_to("save_snapshot")
- end
+ methods.each do |method|
+ it "responds to #{method}" do
+ expect(subject).to respond_to(method)
+ end
+ end
- it "should respond to get_aggregate" do
- subject.should respond_to("get_aggregate")
- end
-
- it "should respond to get_aggregate_events" do
- subject.should respond_to("get_aggregate_events")
- end
-
- it "should respond to get_aggregate_list_by_typename" do
- subject.should respond_to("get_aggregate_list_by_typename")
- end
-
- it "should respond to get_all_typenames" do
- subject.should respond_to("get_all_typenames")
- end
-
- it "should respond to get_snapshot" do
- subject.should respond_to("get_snapshot")
- end
-
- it "should respond to get_new_events_after_event_id_matching_classname" do
- subject.should respond_to("get_new_events_after_event_id_matching_classname")
- end
-
- it "should respond to get_events_after_sequence_id" do
- subject.should respond_to(:get_events)
- end
- it("should respond to url"){ expect(subject).to respond_to :url }
- it("should respond to context"){ expect(subject).to respond_to :context }
- it("should respond to driver"){ expect(subject).to respond_to :driver }
- end
+ end
end
end
|
Refactor interface spec and change/add methods
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.