diff stringlengths 65 26.7k | message stringlengths 7 9.92k |
|---|---|
diff --git a/app/controllers/namespaces_controller.rb b/app/controllers/namespaces_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/namespaces_controller.rb
+++ b/app/controllers/namespaces_controller.rb
@@ -14,7 +14,7 @@
if user
redirect_to user_path(user)
- elsif group && can?(current_user, :read_group, group)
+ elsif group
redirect_to group_path(group)
elsif current_user.nil?
authenticate_user!
| Allow access to group from root url
|
diff --git a/spec/support/discovery_link_behaviour.rb b/spec/support/discovery_link_behaviour.rb
index abc1234..def5678 100644
--- a/spec/support/discovery_link_behaviour.rb
+++ b/spec/support/discovery_link_behaviour.rb
@@ -5,7 +5,7 @@ :headers => {
'Content-Type' => 'application/json'
},
- :body => Yajl::Encoder.encode(meta_post)
+ :body => Yajl::Encoder.encode({"post" => meta_post })
)
end
| Fix spec (wrap meta post response)
|
diff --git a/lib/ice_nine/support/recursion_guard.rb b/lib/ice_nine/support/recursion_guard.rb
index abc1234..def5678 100644
--- a/lib/ice_nine/support/recursion_guard.rb
+++ b/lib/ice_nine/support/recursion_guard.rb
@@ -17,10 +17,10 @@ # Guard against recursively calling a block with the same object
#
# @example
- # recursion_guard = IceNine::RecursionGuard.new
- # recursion_guard.guard(object_id) do
- # logic_which_may_be_recursively_called_with_object_id(recursion_guard)
- # end
+ # recursion_guard = IceNine::RecursionGuard.new
+ # recursion_guard.guard(object_id) do
+ # logic_which_may_be_recursively_called_with_object_id(recursion_guard)
+ # end
#
# @param [Integer] caller_object_id
#
| Fix formatting in YARD docs
|
diff --git a/app/models/shoppe/customization_value.rb b/app/models/shoppe/customization_value.rb
index abc1234..def5678 100644
--- a/app/models/shoppe/customization_value.rb
+++ b/app/models/shoppe/customization_value.rb
@@ -2,7 +2,8 @@ class CustomizationValue < ActiveRecord::Base
self.table_name = 'shoppe_customization_values'
belongs_to :customization_type, :class_name => 'Shoppe::CustomizationType'
- has_attached_file :upload, :content_type => ["image/jpg", "image/jpeg", "image/png", "image/gif"]
+ has_attached_file :upload
+ validates_attachment_content_type :upload, :content_type => /\Aimage/
include Rails.application.routes.url_helpers
| Add new stlye for content type validation
|
diff --git a/test/test_binds.rb b/test/test_binds.rb
index abc1234..def5678 100644
--- a/test/test_binds.rb
+++ b/test/test_binds.rb
@@ -0,0 +1,71 @@+require 'helper'
+
+class TestQuery < Test::Unit::TestCase
+ attr_accessor :dbh
+
+ def setup
+ self.dbh = new_database
+ end
+
+ def teardown
+ @dbh.disconnect if @dbh && @dbh.connected?
+ end
+
+ def test_bind_projection_term
+ assert_raise(Rubyfb::FireRubyException, "SELECT ? did not raise expected error") do
+ dbh.execute('select ? from rdb$database', 1)
+ end
+ end
+
+ def test_bind_identifier
+ assert_raise(Rubyfb::FireRubyException, "SELECT ? did not raise expected error") do
+ dbh.execute('select 1 from ?', "rdb$database")
+ end
+ end
+
+ def test_positional_bind
+ sql = <<-__eosql
+ select A, B
+ from (select 'spam', 'eggs'
+ from rdb$database
+ union all
+ select 'foo', 'bar'
+ from rdb$database) T(A, B)
+ where A LIKE ?
+ and
+ 1 = ?
+ __eosql
+ dbh.prepare(sql) do |sth|
+ sth.execute('f%', 1) do |res|
+ assert_equal([['foo', 'bar']], res.fetch(:all))
+ end
+ sth.execute('f%', 0) do |res|
+ assert_equal([], res.fetch(:all))
+ end
+ end
+ end
+
+ def test_named_bind
+ sql = <<-__eosql
+ select A, B
+ from (select 'spam', 'eggs'
+ from rdb$database
+ union all
+ select 'foo', 'bar'
+ from rdb$database) T(A, B)
+ where A LIKE ?pattern
+ and
+ 1 = ?intval
+ __eosql
+
+ dbh.prepare(sql) do |sth|
+ sth.execute({:pattern => 'f%', :intval => 1}) do |res|
+ assert_equal([['foo', 'bar']], res.fetch(:all))
+ end
+ sth.execute({:pattern => 'f%', :intval => 0}) do |res|
+ assert_equal([], res.fetch(:all))
+ end
+ end
+ end
+
+end
| Test parameter binds: named, unnamed, good and bad
|
diff --git a/test/test_query.rb b/test/test_query.rb
index abc1234..def5678 100644
--- a/test/test_query.rb
+++ b/test/test_query.rb
@@ -2,6 +2,11 @@
# Test query DSL
class QueryTest < Minitest::Test
+
+ def setup
+ Bicho.client = nil
+ end
+
def test_active_record_style
# No client set yet
assert_raises RuntimeError do
| Reset Bicho.client as it makes it test order dependent
|
diff --git a/gtm-oauth2-thekey.podspec b/gtm-oauth2-thekey.podspec
index abc1234..def5678 100644
--- a/gtm-oauth2-thekey.podspec
+++ b/gtm-oauth2-thekey.podspec
@@ -1,11 +1,11 @@ Pod::Spec.new do |s|
s.name = "gtm-oauth2-thekey"
- s.version = "1.0.120"
+ s.version = "1.0.123"
s.summary = "Google OAuth2 Framework modified for TheKey."
s.homepage = "https://code.google.com/p/gtm-oauth2/"
s.license = { :type => 'Apache License 2.0', :file => 'LICENSE.txt' }
s.authors = { "Greg Robbins" => "grobbi...@google.com", "Brian Zoetewey" => "brian.zoetewey@ccci.org" }
- s.source = { :git => "git@git.gcx.org:ios/lib/gtm-oauth2-thekey.git", :tag => "v1.0.120" }
+ s.source = { :git => "git@git.gcx.org:ios/lib/gtm-oauth2-thekey.git", :tag => "v1.0.123" }
s.source_files = 'Source/*.{h,m}', 'Source/Touch/*.{h,m}', 'HTTPFetcher/GTMHTTPFetcher.{h,m}'
s.resources = 'Source/Touch/{*.xib}'
s.framework = 'Security', 'SystemConfiguration'
| Increment version to 1.0.123, based on SVN r123
|
diff --git a/Casks/firefoxdeveloperedition-ja.rb b/Casks/firefoxdeveloperedition-ja.rb
index abc1234..def5678 100644
--- a/Casks/firefoxdeveloperedition-ja.rb
+++ b/Casks/firefoxdeveloperedition-ja.rb
@@ -5,6 +5,7 @@ url "https://download.mozilla.org/?product=firefox-aurora-latest-l10n&os=osx&lang=ja-JP-mac"
homepage 'https://www.mozilla.org/ja/firefox/developer/'
license :mpl
+ tags :vendor => 'Mozilla'
app 'FirefoxDeveloperEdition.app'
end
| Add tag stanza to Firefox Developer Edition JA
|
diff --git a/db/migrate/2_add_name_to_subscriptions.rb b/db/migrate/2_add_name_to_subscriptions.rb
index abc1234..def5678 100644
--- a/db/migrate/2_add_name_to_subscriptions.rb
+++ b/db/migrate/2_add_name_to_subscriptions.rb
@@ -0,0 +1,8 @@+class AddNameToSubscriptions < ActiveRecord::Migration
+
+ def change
+ add_column :refinery_subscriptions, :first_name, :string
+ add_column :refinery_subscriptions, :last_name, :string
+ end
+
+end | Add migration for first and last name
|
diff --git a/Casks/freesmug-chromium.rb b/Casks/freesmug-chromium.rb
index abc1234..def5678 100644
--- a/Casks/freesmug-chromium.rb
+++ b/Casks/freesmug-chromium.rb
@@ -1,6 +1,6 @@ cask :v1 => 'freesmug-chromium' do
- version '40.0.2214.94'
- sha256 '404d93a048f86d500320c7d2a11b58bf8391aca190278036688c095fd8d183b2'
+ version '40.0.2214.115'
+ sha256 '00b40f4b903b2ea985e2d1dfd4f822fb23b6954b145c1ebe4cb8bde0d2a60260'
# sourceforge.net is the official download host per the vendor homepage
url "http://downloads.sourceforge.net/sourceforge/osxportableapps/Chromium_OSX_#{version}.dmg"
| Update FreeSMUG Chromium to v40.0.2214.115
|
diff --git a/config/software/ganeti-common-haskell.rb b/config/software/ganeti-common-haskell.rb
index abc1234..def5678 100644
--- a/config/software/ganeti-common-haskell.rb
+++ b/config/software/ganeti-common-haskell.rb
@@ -1,15 +1,17 @@ name "ganeti-common-haskell"
-dependency 'ghc-crypto'
-dependency 'ghc-base64-bytestring'
-dependency 'ghc-curl'
-dependency 'ghc-hinotify'
-dependency 'ghc-json'
-dependency 'ghc-network'
-dependency 'ghc-hslogger'
-dependency 'ghc-regex-pcre'
-dependency 'ghc-attoparsec'
-dependency 'ghc-lifted-base'
-dependency 'ghc-utf8-string'
-dependency 'ghc-vector'
-dependency 'ghc-lens'
+dependency 'cabal-install'
+dependency 'ganeti-haskell'
+#dependency 'ghc-crypto'
+#dependency 'ghc-base64-bytestring'
+#dependency 'ghc-curl'
+#dependency 'ghc-hinotify'
+#dependency 'ghc-json'
+#dependency 'ghc-network'
+#dependency 'ghc-hslogger'
+#dependency 'ghc-regex-pcre'
+#dependency 'ghc-attoparsec'
+#dependency 'ghc-lifted-base'
+#dependency 'ghc-utf8-string'
+#dependency 'ghc-vector'
+#dependency 'ghc-lens'
| Switch to installing all the haskell deps in one shot instead individually
|
diff --git a/app/controllers/browse_controller.rb b/app/controllers/browse_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/browse_controller.rb
+++ b/app/controllers/browse_controller.rb
@@ -1,7 +1,7 @@ class BrowseController < ApplicationController
def index
- setup_page_title("Browse")
+ setup_page_title("All categories")
options = {title: "browse", section_name: "Browse", section_link: "/browse"}
set_slimmer_dummy_artefact(options)
end
| Change 'browse' to 'All categories' as it is more meaningful to users even if they for some reason end up on /browse where they shouldn't really be
|
diff --git a/spec/connectors/swiftiply_client_spec.rb b/spec/connectors/swiftiply_client_spec.rb
index abc1234..def5678 100644
--- a/spec/connectors/swiftiply_client_spec.rb
+++ b/spec/connectors/swiftiply_client_spec.rb
@@ -0,0 +1,66 @@+require File.dirname(__FILE__) + '/../spec_helper'
+
+describe Connectors::SwiftiplyClient do
+ before do
+ @connector = Connectors::SwiftiplyClient.new('0.0.0.0', 3333)
+ @connector.server = mock('server', :null_object => true)
+ end
+
+ it "should connect" do
+ EventMachine.run do
+ @connector.connect
+ EventMachine.stop
+ end
+ end
+
+ it "should disconnect" do
+ EventMachine.run do
+ @connector.connect
+ @connector.disconnect
+ EventMachine.stop
+ end
+ end
+end
+
+describe SwiftiplyConnection do
+ before do
+ @connection = SwiftiplyConnection.new(nil)
+ @connection.connector = Connectors::SwiftiplyClient.new('0.0.0.0', 3333)
+ @connection.connector.server = mock('server', :null_object => true)
+ end
+
+ it do
+ @connection.should be_persistent
+ end
+
+ it "should send handshake on connection_completed" do
+ @connection.should_receive(:send_data).with('swiftclient000000000d0500')
+ @connection.connection_completed
+ end
+
+ it "should reconnect on unbind" do
+ @connection.connector.stub!(:running?).and_return(true)
+ @connection.stub!(:rand).and_return(0) # Make sure we don't wait
+
+ @connection.should_receive(:reconnect).with('0.0.0.0', 3333)
+
+ EventMachine.run do
+ @connection.unbind
+ EventMachine.add_timer(0) { EventMachine.stop }
+ end
+ end
+
+ it "should not reconnect when not running" do
+ @connection.connector.stub!(:running?).and_return(false)
+ EventMachine.should_not_receive(:add_timer)
+ @connection.unbind
+ end
+
+ it "should have a host_ip" do
+ @connection.send(:host_ip).should == [0, 0, 0, 0]
+ end
+
+ it "should generate swiftiply_handshake based on key" do
+ @connection.send(:swiftiply_handshake, 'key').should == 'swiftclient000000000d0503key'
+ end
+end | Add spec for swiftiply connector.
|
diff --git a/potatochop.gemspec b/potatochop.gemspec
index abc1234..def5678 100644
--- a/potatochop.gemspec
+++ b/potatochop.gemspec
@@ -18,6 +18,7 @@ gem.require_paths = ["lib"]
gem.add_runtime_dependency 'sinatra'
gem.add_runtime_dependency 'haml'
+ gem.add_runtime_dependency 'sass'
gem.add_development_dependency 'rspec'
gem.add_development_dependency 'rake'
gem.add_development_dependency 'simplecov'
| Add sass as a dependency
|
diff --git a/app/controllers/errors_controller.rb b/app/controllers/errors_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/errors_controller.rb
+++ b/app/controllers/errors_controller.rb
@@ -1,9 +1,9 @@ class ErrorsController < ApplicationController
def not_found
- render :json => { status: "Error", message: "Route does not exist" }
+ render :json => { status: "Error", message: "Route does not exist" }, :status => 404
end
def exception
- render :json => { status: "Error", message: "A general error has occured and we will look into it." }
+ render :json => { status: "Error", message: "A general error has occured and we will look into it." }, :status => 500
end
end
| Return appropriate status code on error |
diff --git a/spec/features/user_edits_article_spec.rb b/spec/features/user_edits_article_spec.rb
index abc1234..def5678 100644
--- a/spec/features/user_edits_article_spec.rb
+++ b/spec/features/user_edits_article_spec.rb
@@ -0,0 +1,14 @@+require 'spec_helper'
+
+feature "Article Editing" do
+ before(:each) do
+ sign_up
+ new_article
+ click_link 'Edit'
+ end
+
+ scenario "allows user to visit edit article page" do
+ expect(page).to have_content I18n.t('edit_article.subject')
+ end
+
+end | Add spec for editing article
|
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
@@ -13,7 +13,7 @@ @total_results = @google_request["queries"]["request"][0]["totalResults"].to_i
render "index"
rescue
- redirect_to "https://www.google.com/?#q=site:dev.release.kyledornblaser.com+#{params[:search]}"
+ redirect_to "https://www.google.com/?#q=site:www.releasedb.com+#{params[:search]}"
end
end
else
| Change config data for google custom search for production.
|
diff --git a/app/controllers/explore_controller.rb b/app/controllers/explore_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/explore_controller.rb
+++ b/app/controllers/explore_controller.rb
@@ -4,9 +4,9 @@ layout 'explore'
def index
- render_404 and return if current_user.nil? || !current_user.has_feature_flag?("explore_site")
username = CartoDB.extract_subdomain(request).strip.downcase
@viewed_user = User.where(username: username).first
+ render_404 and return if @viewed_user.nil? || !@viewed_user.has_feature_flag?("explore_site")
@default_fallback_basemap = @viewed_user.default_basemap
respond_to do |format|
@@ -15,7 +15,9 @@ end
def search
- render_404 and return if current_user.nil? || !current_user.has_feature_flag?("explore_site")
+ username = CartoDB.extract_subdomain(request).strip.downcase
+ @viewed_user = User.where(username: username).first
+ render_404 and return if @viewed_user.nil? || !@viewed_user.has_feature_flag?("explore_site")
@query_param = params[:q]
respond_to do |format|
format.html { render 'search' }
| Use viewed user instead of current user to disable explore access
|
diff --git a/app/controllers/uploads_controller.rb b/app/controllers/uploads_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/uploads_controller.rb
+++ b/app/controllers/uploads_controller.rb
@@ -1,7 +1,7 @@ class UploadsController < ApplicationController
def remove
puts params
- upload = controller_name.classify.constantize.find params.values.last
+ upload = params[:model].classify.constantize.find params.values.first
puts upload
s3 = AWS::S3.new
bucket = s3.buckets["gradecraft-#{Rails.env}"]
| Create single controller for all uploads.
|
diff --git a/app/models/spree/payment_decorator.rb b/app/models/spree/payment_decorator.rb
index abc1234..def5678 100644
--- a/app/models/spree/payment_decorator.rb
+++ b/app/models/spree/payment_decorator.rb
@@ -1,7 +1,9 @@ module Spree
module PaymentDecorator
def handle_response(response, success_state, failure_state)
- self.intent_client_key = response.params['client_secret'] if response.params['client_secret'] && response.success?
+ if response.success? && response.respond_to?(:params)
+ self.intent_client_key = response.params['client_secret'] if response.params['client_secret']
+ end
super
end
| Verify the response from the payment provider responds to params
|
diff --git a/tincan-api.gemspec b/tincan-api.gemspec
index abc1234..def5678 100644
--- a/tincan-api.gemspec
+++ b/tincan-api.gemspec
@@ -1,7 +1,7 @@ Gem::Specification.new do |s|
s.name = "tincan-api"
- s.version = "1.2.1"
- s.date = "2014-05-08"
+ s.version = "1.2.2"
+ s.date = "2014-05-17"
s.summary = "Ruby gem for the TinCan Storage API"
s.authors = ["Charles Hollenbeck"]
s.email = "charles@hollenbeck.pw"
| Update Gem version to be 1.2.2
|
diff --git a/lib/phil_columns/command/generate/seed.rb b/lib/phil_columns/command/generate/seed.rb
index abc1234..def5678 100644
--- a/lib/phil_columns/command/generate/seed.rb
+++ b/lib/phil_columns/command/generate/seed.rb
@@ -16,7 +16,7 @@ protected
def template_filepath
- 'templates/seed_class.erb'
+ File.expand_path( '../../../../../templates/seed_class.erb', __FILE__ )
end
end
| Fix issue with template path in generator.
|
diff --git a/lib/rspec/matchers/built_in/be_between.rb b/lib/rspec/matchers/built_in/be_between.rb
index abc1234..def5678 100644
--- a/lib/rspec/matchers/built_in/be_between.rb
+++ b/lib/rspec/matchers/built_in/be_between.rb
@@ -19,7 +19,7 @@
def matches?(actual)
@actual = actual
- comparable? and compare
+ comparable? && compare
rescue ArgumentError
false
end
@@ -35,7 +35,7 @@ private
def comparable?
- @actual.respond_to?(@less_than_operator) and @actual.respond_to?(@greater_than_operator)
+ @actual.respond_to?(@less_than_operator) && @actual.respond_to?(@greater_than_operator)
end
def not_comparable_clause
@@ -43,7 +43,7 @@ end
def compare
- @actual.__send__(@greater_than_operator, @min) and @actual.__send__(@less_than_operator, @max)
+ @actual.__send__(@greater_than_operator, @min) && @actual.__send__(@less_than_operator, @max)
end
end
end
| Use && instead of and
|
diff --git a/spec/models/food_spec.rb b/spec/models/food_spec.rb
index abc1234..def5678 100644
--- a/spec/models/food_spec.rb
+++ b/spec/models/food_spec.rb
@@ -12,6 +12,19 @@ end
describe "#display" do
+ it "creates a concatenated title for food" do
+ food = create(:food)
+
+ expect(food.display).to eq("Apple - 1.0 - medium (3\" dia)")
+ end
+ end
+
+ describe "#get_unique_name" do
+ it "creates unique name for db storage" do
+ food = create(:food)
+
+ expect(food.get_unique_name).to eq(food.unique_name)
+ end
end
describe ".find_or_create_from_api" do
| Add missing tests for food model
|
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
@@ -2,35 +2,58 @@
describe User do
- let(:user) { FactoryGirl.create(:user) }
+ describe '#valid?' do
+ subject { FactoryGirl.build(:user, params) }
- it 'has a valid factory' do
- user.should be_valid
+ context 'default factory' do
+ let(:params) { nil }
+
+ it { should be_valid }
+ end
+
+ context 'without email' do
+ let(:params) { {email: nil} }
+
+ it { should_not be_valid }
+ end
+
+ context 'with invalid email' do
+ let(:params) { {email: 'nil@'} }
+
+ it { should_not be_valid }
+ end
+
+ context 'without password' do
+ let(:params) { {password: nil} }
+
+ it { should_not be_valid }
+ end
+
+ context 'is invalid if the email exists' do
+ let(:params) { {password: nil} }
+ let!(:existing_user) { FactoryGirl.create(:user, email: subject.email) }
+
+ it { should_not be_valid }
+ it { should have(1).error_on(:email) }
+ end
end
- it 'is invalid without email, or invalid email' do
- FactoryGirl.build(:user, email: nil).should_not be_valid
+ describe '#save' do
+ subject { FactoryGirl.create(:user) }
- FactoryGirl.build(:user, email: 'nil@').should_not be_valid
+ context 'accept a blank password if the user exists' do
+ before { subject.password = '' }
+
+ it { should be_valid }
+ it { expect(subject.save).to be_true }
+ end
end
- it 'is invalid without password' do
- FactoryGirl.build(:user, password: nil).should_not be_valid
- end
+ describe '#destroy' do
+ subject { FactoryGirl.create(:user) }
- it 'accept a blank password if the user exists' do
- user.password = ''
- user.should be_valid
- user.save.should be_true
- end
-
- it 'is invalid if the email exists' do
- new_user = FactoryGirl.build(:user, email: user.email)
- new_user.should_not be_valid
- new_user.should have(1).error_on(:email)
- end
-
- it "can't delete the last admin" do
- expect { user.destroy }.to raise_error 'Must be at least one admin'
+ context "can't delete the last admin" do
+ it { expect { subject.destroy }.to raise_error 'Must be at least one admin' }
+ end
end
end
| Refactor User specs for readability
|
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
@@ -10,15 +10,16 @@ User.update_or_create(auth)
new_user = User.first
- expect(new_user.provider).to eq("google")
expect(new_user.uid).to eq("12345678910")
- expect(new_user.email).to eq("jesse@mountainmantechnologies.com")
expect(new_user.first_name).to eq("Jesse")
- expect(new_user.last_name).to eq("Spevack")
- expect(new_user.token).to eq("abcdefg12345")
- expect(new_user.refresh_token).to eq("12345abcdefg")
expect(new_user.oauth_expires_at).to eq(auth[:credentials][:expires_at])
+ end
+ describe 'associations' do
+ xit { should have_many(:pins)}
+ xit { should have_many(:comments)}
+ # it { should have_many(:votes)} if we have votes
end
+
end
end
| Add associations tests for models to have many comments and pins
|
diff --git a/spec/github_cli/commands/statuses_spec.rb b/spec/github_cli/commands/statuses_spec.rb
index abc1234..def5678 100644
--- a/spec/github_cli/commands/statuses_spec.rb
+++ b/spec/github_cli/commands/statuses_spec.rb
@@ -0,0 +1,28 @@+# encoding: utf-8
+
+require 'spec_helper'
+
+describe GithubCLI::Commands::Statuses do
+ let(:format) { 'table' }
+ let(:user) { 'peter-murach' }
+ let(:repo) { 'github_cli' }
+ let(:sha) { '7f86c1b73255d4409348d68eb75f7cbbc2aa5c74' }
+ let(:api_class) { GithubCLI::Status }
+
+ it "invokes status:list" do
+ api_class.should_receive(:all).with(user, repo, sha, {}, format)
+ subject.invoke "status:list", [user, repo, sha]
+ end
+
+ it "invokes status:create" do
+ api_class.should_receive(:create).with(user, repo, sha, {}, format)
+ subject.invoke "status:create", [user, repo, sha]
+ end
+
+ it "invokes status:create --state --target" do
+ api_class.should_receive(:create).with(user, repo, sha,
+ {'state' => 'pending', 'target_url' => 'http://ci.example.com'}, format)
+ subject.invoke "status:create", [user, repo, sha], :state => 'pending',
+ :target => "http://ci.example.com"
+ end
+end
| Add test specs for statuses commands.
|
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
@@ -6,8 +6,9 @@ describe "#valid?" do
describe "password" do
it "password != password_confirmation is invalid" do
- user.password = "a"
- user.password_confirmation = "b"
+ user.current_password = user.password
+ user.password = "aaaaaaaa"
+ user.password_confirmation = "bbbbbbbb"
user.should_not be_valid
end
end
| Fix the broken model spec
Before, validated user is invalid, but other validations cause (length,
and wrong current_password)
|
diff --git a/spec/semmy/tasks_spec.rb b/spec/semmy/tasks_spec.rb
index abc1234..def5678 100644
--- a/spec/semmy/tasks_spec.rb
+++ b/spec/semmy/tasks_spec.rb
@@ -0,0 +1,76 @@+require 'spec_helper'
+
+module Semmy
+ describe Tasks, fixture_files: true do
+ describe 'release:prepare task' do
+ it 'passes on master' do
+ Fixtures.gemspec(name: 'my_gem', module: 'MyGem')
+ Fixtures.version_file('lib/my_gem/version.rb',
+ module: 'MyGem',
+ version: '1.5.0.dev')
+ Fixtures.file('CHANGELOG.md', <<-END)
+ # Changelog
+
+ ### Changes on `master`
+ END
+
+ git = Fixtures.git_workspace
+ git.add(all: true)
+ git.commit('Initial commit')
+
+ Tasks.install
+
+ expect {
+ Rake.application['release:prepare'].invoke
+ }.not_to raise_error
+ end
+
+ it 'passes on stable branch' do
+ Fixtures.gemspec(name: 'my_gem', module: 'MyGem')
+ Fixtures.version_file('lib/my_gem/version.rb',
+ module: 'MyGem',
+ version: '1.5.2')
+ Fixtures.file('CHANGELOG.md', <<-END)
+ # Changelog
+
+ ### Changes on `master`
+ END
+
+ git = Fixtures.git_workspace
+ git.add(all: true)
+ git.commit('Initial commit')
+ git.branch('1-5-stable').checkout
+
+ Tasks.install
+
+ expect {
+ Rake.application['release:prepare'].invoke
+ }.not_to raise_error
+ end
+ end
+
+ describe 'release:after task' do
+ it 'passes on master' do
+ Fixtures.gemspec(name: 'my_gem', module: 'MyGem')
+ Fixtures.version_file('lib/my_gem/version.rb',
+ module: 'MyGem',
+ version: '1.5.0')
+ Fixtures.file('CHANGELOG.md', <<-END)
+ # Changelog
+
+ ### Version 1.5.0
+ END
+
+ git = Fixtures.git_workspace
+ git.add(all: true)
+ git.commit('Prepare 1.5 release')
+
+ Tasks.install
+
+ expect {
+ Rake.application['release:after'].invoke
+ }.not_to raise_error
+ end
+ end
+ end
+end
| Add smoke test for main rake tasks
|
diff --git a/config/initializers/constants.rb b/config/initializers/constants.rb
index abc1234..def5678 100644
--- a/config/initializers/constants.rb
+++ b/config/initializers/constants.rb
@@ -1,4 +1,4 @@-DOC_URL = "https://demarches-simplifiees.gitbook.io/demarches-simplifiees/"
+DOC_URL = "https://demarches-simplifiees.gitbook.io/demarches-simplifiees"
LISTE_DES_DEMARCHES_URL = "https://demarches-simplifiees.gitbook.io/demarches-simplifiees/listes-des-demarches"
CGU_URL = "https://demarches-simplifiees.gitbook.io/demarches-simplifiees/cgu"
MENTIONS_LEGALES_URL = "https://demarches-simplifiees.gitbook.io/demarches-simplifiees/cgu#4.-mentions-legales"
| Remove trailing slash from DOC_URL |
diff --git a/test/emails/send_daily_triage_email_test.rb b/test/emails/send_daily_triage_email_test.rb
index abc1234..def5678 100644
--- a/test/emails/send_daily_triage_email_test.rb
+++ b/test/emails/send_daily_triage_email_test.rb
@@ -2,14 +2,22 @@
class UserMailerTest < ActionMailer::TestCase
include ActiveJob::TestHelper::TestQueueAdapter
+ def time_preference_for_today(time)
+ now = Time.current
+ Time.utc(now.year, now.month, now.day, time.hour, time.min, time.sec)
+ end
+
+ def send_email(user)
+ assert_performed_with(job: ActionMailer::DeliveryJob, queue: "mailers") do
+ Time.stub(:now, time_preference_for_today(SendDailyTriageEmailJob::DEFAULT_EMAIL_TIME_OF_DAY) + 1.hour) do
+ SendDailyTriageEmailJob.new.perform(user)
+ end
+ end
+ end
test "sends issues" do
user = users(:schneems)
-
- assert_performed_with(job: ActionMailer::DeliveryJob, queue: "mailers") do
- SendDailyTriageEmailJob.new.perform(user)
- end
-
+ send_email(user)
triage_email = ActionMailer::Base.deliveries.last
triage_email_text = triage_email.text_part.to_s
@@ -24,11 +32,7 @@
test "sends docs" do
user = users(:bar_user)
-
- assert_performed_with(job: ActionMailer::DeliveryJob, queue: "mailers") do
- SendDailyTriageEmailJob.new.perform(user)
- end
-
+ send_email(user)
triage_email = ActionMailer::Base.deliveries.last
triage_email_text = triage_email.text_part.to_s
| Make email test not time dependent
|
diff --git a/test/fixtures/rails_app/app/models/asset.rb b/test/fixtures/rails_app/app/models/asset.rb
index abc1234..def5678 100644
--- a/test/fixtures/rails_app/app/models/asset.rb
+++ b/test/fixtures/rails_app/app/models/asset.rb
@@ -13,19 +13,27 @@ # Dragonfly Stuff
#
- image_accessor :dragonfly
+ if defined?(Dragonfly)
- image_accessor :dragonfly_required
- validates :dragonfly_required, :presence => true
+ image_accessor :dragonfly
+
+ image_accessor :dragonfly_required
+ validates :dragonfly_required, :presence => true
+
+ end
##
# Paperclip Stuff
#
- has_attached_file :paperclip, :styles => { :medium => "300x300>", :thumb => "100x100>" }
+ if defined?(Paperclip)
- has_attached_file :paperclip_required, :styles => { :medium => "300x300>", :thumb => "100x100>" }
- validates_attachment_presence :paperclip_required
+ has_attached_file :paperclip, :styles => { :medium => "300x300>", :thumb => "100x100>" }
+
+ has_attached_file :paperclip_required, :styles => { :medium => "300x300>", :thumb => "100x100>" }
+ validates_attachment_presence :paperclip_required
+
+ end
##
# Instance Methods
| Use methods only if modules are defined.
|
diff --git a/db/seeds.rb b/db/seeds.rb
index abc1234..def5678 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -0,0 +1,8 @@+#http://www.cocktails.eu/alphabetical/index.php?letter=a
+
+#find sibling of .list_head elements
+
+#https://blog.hartleybrody.com/web-scraping/
+
+#iterate over letter=a&i=2
+#a=17, b=37, c=35, d=13, e=5, f=18, g=17 , h=13 , i=6 , j=8 , k=7 , l=13 , m=21 , n=7 , o=6 , p=18 , q=1 , r=12 , s=25 , t=16 , u=1 , v=4 , w=7 , x=1 , y=2 , z=1
| Add research for scraping cocktail recipes
|
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
@@ -0,0 +1,188 @@+require 'spec_helper'
+
+describe User do
+ before(:each) do
+ @user = Fabricate(:user)
+ end
+
+ describe "module/plugin inclusions (optional)" do
+ end
+
+ describe "validations" do
+ end
+
+ describe "association" do
+ end
+
+ describe "callbacks" do
+ end
+
+ describe "named scopes" do
+ end
+
+ describe "class methods" do
+ describe "User#find_for_authentication" do
+ end
+
+ describe "User#find_by_login_or_id" do
+ end
+
+ describe "User#find_experts" do
+ end
+ end
+
+ describe "instance methods" do
+ describe "User#membership_list" do
+ end
+
+ describe "User#login=" do
+ end
+
+ describe "User#email=" do
+ end
+
+ describe "User#to_param" do
+ end
+
+ describe "User#add_preferred_tags" do
+ end
+
+ describe "User#remove_preferred_tags" do
+ end
+
+ describe "User#preferred_tags_on" do
+ end
+
+ describe "User#update_language_filter" do
+ end
+
+ describe "User#languages_to_filter" do
+ end
+
+ describe "User#is_preferred_tag?" do
+ end
+
+ describe "User#admin?" do
+ end
+
+ describe "User#age" do
+ end
+
+ describe "User#can_modify?" do
+ end
+
+ describe "User#groups" do
+ end
+
+ describe "User#member_of?" do
+ end
+
+ describe "User#role_on" do
+ end
+
+ describe "User#owner_of?" do
+ end
+
+ describe "User#mod_of?" do
+ end
+
+ describe "User#editor_of?" do
+ end
+
+ describe "User#user_of?" do
+ end
+
+ describe "User#main_language" do
+ end
+
+ describe "User#openid_login?" do
+ end
+
+ describe "User#twitter_login?" do
+ end
+
+ describe "User#has_voted?" do
+ end
+
+ describe "User#vote_on" do
+ end
+
+ describe "User#favorite?" do
+ end
+
+ describe "User#favorite" do
+ end
+
+ describe "User#logged!" do
+ end
+
+ describe "User#on_activity" do
+ end
+
+ describe "User#activity_on" do
+ end
+
+ describe "User#reset_activity_days!" do
+ end
+
+ describe "User#upvote!" do
+ end
+
+ describe "User#downvote!" do
+ end
+
+ describe "User#update_reputation" do
+ end
+
+ describe "User#reputation_on" do
+ end
+
+ describe "User#stats" do
+ end
+
+ describe "User#badges_count_on" do
+ end
+
+ describe "User#badges_on" do
+ end
+
+ describe "User#find_badge_on" do
+ end
+
+ describe "User#add_friend" do
+ end
+
+ describe "User#remove_friend" do
+ end
+
+ describe "User#followers" do
+ end
+
+ describe "User#following" do
+ end
+
+ describe "User#following?" do
+ end
+
+ describe "User#viewed_on!" do
+ end
+
+ describe "User#config_for" do
+ end
+
+ describe "User#reputation_stats" do
+ end
+
+ describe "User#has_flagged?" do
+ end
+
+ describe "User#has_requested_to_close?" do
+ end
+
+ describe "User#has_requested_to_open?" do
+ end
+
+ describe "User#generate_uuid" do
+ end
+ end
+end
| Add file for user specs
Signed-off-by: Jorge H. Cuadrado <f24d0cb14d293fb1f3cb2016ae41425d3291832c@gmail.com>
|
diff --git a/spec/unit/config_spec.rb b/spec/unit/config_spec.rb
index abc1234..def5678 100644
--- a/spec/unit/config_spec.rb
+++ b/spec/unit/config_spec.rb
@@ -16,11 +16,14 @@ describe '#hash' do
it { should respond_to( :hash ) }
- it 'should add a new hash' do
- Eastwood.hash :foo, '#/bar'
+ describe 'adding a hash' do
+ before do
+ Eastwood.hash :foo, '#/bar'
+ end
- Eastwood.hashes.should have_key( :foo )
- Eastwood.hashes[ :foo ].should eq( '#/bar' )
+ subject { Eastwood.hashes }
+
+ it { should include( :foo => '#/bar' ) }
end
end
end
| Use more specific matcher for hashes
|
diff --git a/spec/unit/spec_helper.rb b/spec/unit/spec_helper.rb
index abc1234..def5678 100644
--- a/spec/unit/spec_helper.rb
+++ b/spec/unit/spec_helper.rb
@@ -7,7 +7,7 @@ config.version = '10.11.1' # via https://github.com/customink/fauxhai/tree/master/lib/fauxhai/platforms/mac_os_x
config.before do
stub_const('ENV', 'SUDO_USER' => 'fauxhai')
- stub_command('which git').and_return(true)
+ stub_command('which git').and_return(true) # because of homebrew recipe
end
config.after(:suite) { FileUtils.rm_r('.librarian') }
end
| Add comment to command stub
|
diff --git a/db/migrate/20160615191922_set_missing_stage_on_ci_builds.rb b/db/migrate/20160615191922_set_missing_stage_on_ci_builds.rb
index abc1234..def5678 100644
--- a/db/migrate/20160615191922_set_missing_stage_on_ci_builds.rb
+++ b/db/migrate/20160615191922_set_missing_stage_on_ci_builds.rb
@@ -0,0 +1,9 @@+class SetMissingStageOnCiBuilds < ActiveRecord::Migration
+ include Gitlab::Database::MigrationHelpers
+
+ def up
+ update_column_in_batches(:ci_builds, :stage, :test) do |table, query|
+ query.where(table[:stage].eq(nil))
+ end
+ end
+end
| Set missing stages on ci builds to 'test' to avoid regressions in the pipelines view
|
diff --git a/gtk3/sample/misc/cairo-cursor.rb b/gtk3/sample/misc/cairo-cursor.rb
index abc1234..def5678 100644
--- a/gtk3/sample/misc/cairo-cursor.rb
+++ b/gtk3/sample/misc/cairo-cursor.rb
@@ -0,0 +1,37 @@+=begin
+ cairo_cursor.rb Ruby/GTK3 script
+ Adapted from https://developer.gnome.org/gtk3/stable/ch25s02.html#id-1.6.3.4.5
+ Copyright (c) 2015 Ruby-GNOME2 Project Team
+ This program is licenced under the same licence as Ruby-GNOME2.
+=end
+
+require "gtk3"
+
+window = Gtk::Window.new("Gdk cursor sample")
+window.signal_connect("destroy") { Gtk.main_quit }
+
+# see cairo formats information here:
+# http://cairographics.org/manual/cairo-Image-Surfaces.html#cairo-format-t
+surface = Cairo::ImageSurface.new(Cairo::FORMAT_ARGB32, 6, 6)
+
+cr = Cairo::Context.new(surface)
+cr.set_source_rgba(0, 1, 0, 0.7)
+cr.arc(3, 3, 3, 0, 2 * Math::PI)
+cr.fill
+cr.destroy
+
+pixbuf = surface.to_pixbuf(0, 0, 6, 6)
+cursor = Gdk::Cursor.new(pixbuf, 0, 0)
+
+# generate the underlaying GDK resource associated with the window widget.
+# Here just create window.window without calling #show_all method.
+window.realize
+window.window.set_cursor(cursor)
+
+label = Gtk::Label.new("Put your cursor on this window.")
+window.add(label)
+
+window.set_default_size(200, 100)
+window.show_all
+
+Gtk.main
| Add example of a Gdk::Cursor based on Cairo
|
diff --git a/spec/prime_spec.rb b/spec/prime_spec.rb
index abc1234..def5678 100644
--- a/spec/prime_spec.rb
+++ b/spec/prime_spec.rb
@@ -1,6 +1,20 @@ require_relative '../lib/prime.rb'
describe Prime do
- it 'checks if a number is prime'
- it 'generates any number of primes'
+ it 'checks if a number is prime' do
+ expect(Prime.valid?(10)).to eq(false)
+ expect(Prime.valid?(49)).to eq(false)
+ expect(Prime.valid?(101)).to eq(true)
+ expect(Prime.valid?(29)).to eq(true)
+ end
+
+ it 'generates any number of primes' do
+ expect(Prime.first(10)).to eq([2, 3, 5, 7, 11, 13, 17, 19, 23, 29])
+ expect(Prime.first(5)).to eq([2, 3, 5, 7, 11])
+ expect(Prime.first(20)).to eq([2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71])
+ end
+
+ it 'generates 10 primes by default' do
+ expect(Prime.first).to eq([2, 3, 5, 7, 11, 13, 17, 19, 23, 29])
+ end
end
| Write tests for validating Prime behavior
|
diff --git a/Casks/pharo.rb b/Casks/pharo.rb
index abc1234..def5678 100644
--- a/Casks/pharo.rb
+++ b/Casks/pharo.rb
@@ -1,6 +1,6 @@ class Pharo < Cask
version '3.0'
- sha256 'f811c7ab77240c680ac74f0d50390101cd61007f027045a9c68322f7dadc6c38'
+ sha256 '2aae5efd2d6e93df29ca5e04f2ad95c22494ff3d0e27c50276c25c298c0a58b1'
url "http://files.pharo.org/platform/Pharo#{version}-mac.zip"
homepage 'http://www.pharo-project.org/home'
| Fix checksum in Pharo.app Cask
|
diff --git a/lib/conceptql/database.rb b/lib/conceptql/database.rb
index abc1234..def5678 100644
--- a/lib/conceptql/database.rb
+++ b/lib/conceptql/database.rb
@@ -10,7 +10,6 @@ if db
db.extension :date_arithmetic
db.extension :error_sql
- db.quote_identifiers = true
db_type = db.database_type.to_sym
end
@opts = opts.revalue { |v| v ? v.to_sym : v }
| Remove hack now that sequel-impala is fixed
|
diff --git a/faraday_middleware-oauth2_refresh.gemspec b/faraday_middleware-oauth2_refresh.gemspec
index abc1234..def5678 100644
--- a/faraday_middleware-oauth2_refresh.gemspec
+++ b/faraday_middleware-oauth2_refresh.gemspec
@@ -6,7 +6,7 @@ s.description = 'This Faraday middleware gem adds OAuth2 token handling with token refresh'
s.authors = ['John Wang']
s.email = 'johncwang@gmail.com'
- s.homepage = 'https://github.com/grokify/'
+ s.homepage = 'https://github.com/grokify/faraday_middleware-oauth2_refresh'
s.licenses = ['MIT']
s.files = [
'CHANGELOG.md',
| Update homepage for RubyGems GitHub link |
diff --git a/lib/akamai_api/cp_code.rb b/lib/akamai_api/cp_code.rb
index abc1234..def5678 100644
--- a/lib/akamai_api/cp_code.rb
+++ b/lib/akamai_api/cp_code.rb
@@ -13,22 +13,16 @@ end
def self.all
- response, result = [], []
-
basic_auth *AkamaiApi.config[:auth]
response = client.request('getCPCodes').body[:multi_ref]
- # We want an array to loop
- response = [response] if response.is_a? Hash
-
- response.map do |hash|
- result << new({
+ Array.wrap(response).map do |hash|
+ new({
:code => hash[:cpcode],
:description => hash[:description],
:service => hash[:service],
})
end
- result
end
end
end | Use Array.wrap instead of use alternative variables
|
diff --git a/vim-flavor.gemspec b/vim-flavor.gemspec
index abc1234..def5678 100644
--- a/vim-flavor.gemspec
+++ b/vim-flavor.gemspec
@@ -4,8 +4,8 @@ Gem::Specification.new do |gem|
gem.authors = ['Kana Natsuno']
gem.email = ['dev@whileimautomaton.net']
- gem.description = %q{See the README file.}
gem.summary = %q{A tool to manage your favorite Vim plugins}
+ gem.description = gem.summary
gem.homepage = 'https://github.com/kana/vim-flavor'
gem.executables = `git ls-files -- bin/*`.split(/\n/).map{ |f| File.basename(f) }
| Fix the useless description in the gemspec
|
diff --git a/lib/guessr.rb b/lib/guessr.rb
index abc1234..def5678 100644
--- a/lib/guessr.rb
+++ b/lib/guessr.rb
@@ -13,8 +13,17 @@
class Hangman < Base
validates :answer, presence: true,
- format: { with: /^[a-z]+$/, message: "only lowercase words allowed"},
+ format: { with: /^[a-z]+$/, message: "only lowercase words allowed"}
serialize :guesses
+
+ def finished?
+ self.turns.zero? || self.answer.chars.all? { |l| self.guesses.include?(l) }
+ end
+
+ def guess_letter(letter)
+ self.guesses.add(letter)
+ self.turns -= 1 unless self.answer.include?(letter)
+ end
end
class BasicSchema < V 1.0
| Add finished? and guess_letter methods on Hangman.
|
diff --git a/pwwka.gemspec b/pwwka.gemspec
index abc1234..def5678 100644
--- a/pwwka.gemspec
+++ b/pwwka.gemspec
@@ -8,7 +8,7 @@ s.platform = Gem::Platform::RUBY
s.authors = ['Stitch Fix Engineering']
s.email = ['opensource@stitchfix.com']
- s.homepage = "http://www.stitchfix.com"
+ s.homepage = "https://github.com/stitchfix/pwwka"
s.summary = "Send and receive messages via RabbitMQ"
s.description = "The purpose of this gem is to normalise the sending and
receiving of messages between Rails apps using the shared RabbitMQ
| Make homepage GitHub repo, so gem information is easily accessible
|
diff --git a/aggregate_root/spec/no_warnings_spec.rb b/aggregate_root/spec/no_warnings_spec.rb
index abc1234..def5678 100644
--- a/aggregate_root/spec/no_warnings_spec.rb
+++ b/aggregate_root/spec/no_warnings_spec.rb
@@ -1,6 +1,6 @@ require 'spec_helper'
-module RubyEventStore
+module AggregateRoot
RSpec.describe 'no warnings' do
specify do
expect(aggregate_root_warnings).to eq([])
| Rename enclosing module to match gem.
|
diff --git a/lib/erudite/executable.rb b/lib/erudite/executable.rb
index abc1234..def5678 100644
--- a/lib/erudite/executable.rb
+++ b/lib/erudite/executable.rb
@@ -24,7 +24,7 @@ end
def self.format_failing_example(example)
- <<-"TXT"
+ <<-"TEXT"
- FAIL
Source: #{example.source}
Expected:
@@ -33,7 +33,7 @@ Actual:
Output: #{example.actual.output.inspect}
Result: #{example.actual.result.inspect}
- TXT
+ TEXT
end
end
end
| Use the same heredoc delimiters everywhere
|
diff --git a/govuk-content-schema-test-helpers.gemspec b/govuk-content-schema-test-helpers.gemspec
index abc1234..def5678 100644
--- a/govuk-content-schema-test-helpers.gemspec
+++ b/govuk-content-schema-test-helpers.gemspec
@@ -21,4 +21,5 @@ s.add_development_dependency 'gem_publisher', '1.5.0'
s.add_development_dependency 'rake', '10.4.2'
s.add_development_dependency 'rspec', '3.2.0'
+ s.add_development_dependency 'pry-byebug'
end
| Add pry-byebug as development dependency
Use it for debugging.
|
diff --git a/lib/chefspec/berkshelf.rb b/lib/chefspec/berkshelf.rb
index abc1234..def5678 100644
--- a/lib/chefspec/berkshelf.rb
+++ b/lib/chefspec/berkshelf.rb
@@ -7,38 +7,48 @@ " to your Gemfile:\n\n gem 'berkshelf'\n\n"
end
-require 'fileutils'
-
module ChefSpec
class Berkshelf
class << self
extend Forwardable
- def_delegators :instance, :setup!
+ def_delegators :instance, :setup!, :teardown!
end
include Singleton
def initialize
+ @tmpdir = Dir.mktmpdir
setup!
end
+ #
+ # Setup and install the necessary dependencies in the temporary directory.
+ #
def setup!
- tmpdir = Dir.mktmpdir
+ teardown! # Berkshelf 3.0 requires the directory to be empty
+ FileUtils.mkdir_p(@tmpdir)
::Berkshelf.ui.mute do
if ::Berkshelf::Berksfile.method_defined?(:vendor)
- FileUtils.rm_rf(tmpdir)
- ::Berkshelf::Berksfile.from_file('Berksfile').vendor(tmpdir)
+ ::Berkshelf::Berksfile.from_file('Berksfile').vendor(@tmpdir)
else
- ::Berkshelf::Berksfile.from_file('Berksfile').install(path: tmpdir)
+ ::Berkshelf::Berksfile.from_file('Berksfile').install(path: @tmpdir)
end
end
- ::RSpec.configure do |config|
- config.cookbook_path = tmpdir
- end
+ ::RSpec.configure { |config| config.cookbook_path = @tmpdir }
+ end
+
+ #
+ # Destroy the installed Berkshelf at the temporary directory.
+ #
+ def teardown!
+ FileUtils.rm_rf(@tmpdir) if File.exists?(@tmpdir)
end
end
end
-ChefSpec::Berkshelf.setup!
+RSpec.configure do |config|
+ config.before(:suite) { ChefSpec::Berkshelf.setup! }
+ config.after(:suite) { ChefSpec::Berkshelf.teardown! }
+end
| Use RSpec's `before(:suite)` and `after(:suite)` for Berkshelf
|
diff --git a/lib/time_for_a_boolean.rb b/lib/time_for_a_boolean.rb
index abc1234..def5678 100644
--- a/lib/time_for_a_boolean.rb
+++ b/lib/time_for_a_boolean.rb
@@ -1,5 +1,6 @@ require "active_support/core_ext/module/delegation"
-require "active_record/connection_adapters/column"
+require "active_support/core_ext/time/calculations"
+require "active_model/type"
require "time_for_a_boolean/version"
require "time_for_a_boolean/railtie"
@@ -13,10 +14,10 @@
setter_attribute = "#{field}="
define_method("#{attribute}=") do |value|
- if ActiveRecord::ConnectionAdapters::Column::TRUE_VALUES.include?(value)
+ if ActiveModel::Type::Boolean::FALSE_VALUES.include?(value)
+ send(setter_attribute, nil)
+ else
send(setter_attribute, -> { Time.current }.())
- else
- send(setter_attribute, nil)
end
end
end
| Switch to using Rails 5 false values instead of true
First, rails removed TRUE_VALUES, leaving FALSE_VALUES: https://github.com/rails/rails/commit/a502703c3d2151d4d3b421b29fefdac5ad05df61
Then, the file containing FALSE_VALUES was moved to ActiveModel: https://github.com/rails/rails/commit/9cc8c6f3730df3d94c81a55be9ee1b7b4ffd29f6#diff-9a8a85e0f8b322dc1f9bd9c460c204b8
I decided to use the new FALSE_VALUES constant and switch the conditional around to maintain old behavior.
|
diff --git a/lib/kontrast/page_test.rb b/lib/kontrast/page_test.rb
index abc1234..def5678 100644
--- a/lib/kontrast/page_test.rb
+++ b/lib/kontrast/page_test.rb
@@ -18,6 +18,12 @@ original_query = Rack::Utils.parse_query(uri.query)
new_query = url_params.merge(original_query)
uri.query = Rack::Utils.build_query(new_query)
+
+ # Ensure there's no trailing "?"
+ if uri.query == ""
+ uri.query = nil
+ end
+
return uri.to_s
end
end
| Remove trailing "?" from path
|
diff --git a/publify_core/spec/models/resource_spec.rb b/publify_core/spec/models/resource_spec.rb
index abc1234..def5678 100644
--- a/publify_core/spec/models/resource_spec.rb
+++ b/publify_core/spec/models/resource_spec.rb
@@ -1,4 +1,31 @@ require 'rails_helper'
describe Resource, type: :model do
+ describe '#upload' do
+ let(:blog) { create :blog }
+ let(:resource) { create :resource, blog: blog }
+ let(:img_resource) { Resource.create blog: blog, upload: file_upload('testfile.png', 'image/png') }
+
+ it 'stores files in the correct location' do
+ expected_path = Rails.root.join('public', 'files/resource/1', 'testfile.txt')
+ expect(resource.upload.file.file).to eq expected_path.to_s
+ end
+
+ it 'stores resized images in the correct location' do
+ thumb_path = Rails.root.join('public', 'files/resource/1', 'thumb_testfile.png')
+ expect(img_resource.upload.thumb.file.file).to eq thumb_path.to_s
+ end
+
+ it 'creates three image versions' do
+ expect(img_resource.upload.versions.keys).to match_array [:thumb, :medium, :avatar]
+ end
+
+ it 'gives the correct url for the attachment' do
+ expect(resource.upload_url).to eq '/files/resource/1/testfile.txt'
+ end
+
+ it 'gives the correct url for the image versions' do
+ expect(img_resource.upload_url(:thumb)).to eq '/files/resource/1/thumb_testfile.png'
+ end
+ end
end
| Add tests for Resource upload behavior
|
diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/dashboard_controller.rb
+++ b/app/controllers/dashboard_controller.rb
@@ -2,6 +2,6 @@ before_filter :authenticate_user!
def show
-
+ session[:CTF_FLAG] = "2112"
end
end
| Add a flag in triage.
|
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
@@ -41,6 +41,19 @@ end
end
+ def upvote
+ @question = Question.find(params[:id])
+ @user = current_user
+
+ if @user.voted_for? @question
+ @question.unliked_by @user
+ else
+ @question.liked_by @user
+ end
+
+ redirect_to @question.topic
+ end
+
private
def question_params
| Add upvote action to questions controller
|
diff --git a/app/controllers/summoners_controller.rb b/app/controllers/summoners_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/summoners_controller.rb
+++ b/app/controllers/summoners_controller.rb
@@ -8,8 +8,7 @@ def show
#matches = @summoner.matches.paginate(page: params[:page], per_page: 10)
matches = Match.with_opponent.where(summoner: @summoner).order(match_creation: :desc)
- matches = matches.where(champion: params[:champion].titleize) if params.has_key? :champion
- @matches = matches.paginate(page: params[:page], per_page: 10)
+ @matches = filter_by_params(matches).paginate(page: params[:page], per_page: 10)
end
private
@@ -17,4 +16,17 @@ def set_summoner
@summoner = Summoner.find(params[:id])
end
+
+ def filter_by_params(matches)
+ matches = matches.where(champion: params[:champion].titleize) if params.has_key? :champion
+ matches = matches.where(opponent_champion: params[:opponent].titleize) if params.has_key? :opponent
+ matches = matches.where(lane: params[:lane].upcase) if params.has_key? :lane
+ queue_params = {
+ 'flex' => "RANKED_FLEX_SR",
+ 'solo' => "TEAM_BUILDER_RANKED_SOLO",
+ 'fives' =>"TEAM_BUILDER_DRAFT_RANKED_5x5"
+ }
+ matches = matches.where(queue: queue_params[params[:queue]]) if params.has_key? :queue
+ matches
+ end
end
| Add more filter params (still hidden)
|
diff --git a/lib/pdfshaver/page_set.rb b/lib/pdfshaver/page_set.rb
index abc1234..def5678 100644
--- a/lib/pdfshaver/page_set.rb
+++ b/lib/pdfshaver/page_set.rb
@@ -16,6 +16,14 @@ Page.new(@document, page_index+1)
end
+ def first
+ Page.new(@document, 1)
+ end
+
+ def last
+ Page.new(@document, @document.length)
+ end
+
private
def enumerator(possible_page_numbers="")
page_numbers = extract_page_numbers possible_page_numbers
| Add and first and last to page sets |
diff --git a/lib/plaintweet/web_app.rb b/lib/plaintweet/web_app.rb
index abc1234..def5678 100644
--- a/lib/plaintweet/web_app.rb
+++ b/lib/plaintweet/web_app.rb
@@ -5,7 +5,7 @@ require 'uri'
require 'active_support'
require 'plaintweet/repository'
-require 'english'
+require 'English'
module Plaintweet
class WebApp < Sinatra::Base
| Fix case for English lib
|
diff --git a/lib/rails_admin/engine.rb b/lib/rails_admin/engine.rb
index abc1234..def5678 100644
--- a/lib/rails_admin/engine.rb
+++ b/lib/rails_admin/engine.rb
@@ -5,7 +5,7 @@ class Engine < Rails::Engine
initializer "static assets" do |app|
if app.config.serve_static_assets
- app.middleware.insert 0, ::ActionDispatch::Static, "#{root}/public"
+ app.middleware.insert_after ::ActionDispatch::Static, ::ActionDispatch::Static, "#{root}/public"
end
end
| Make rails admin static assets override everything apart from static assets in the main application.
|
diff --git a/lib/file_data/formats/mpeg4/box_stream.rb b/lib/file_data/formats/mpeg4/box_stream.rb
index abc1234..def5678 100644
--- a/lib/file_data/formats/mpeg4/box_stream.rb
+++ b/lib/file_data/formats/mpeg4/box_stream.rb
@@ -4,12 +4,17 @@ class BoxStream
def initialize(stream)
@stream = stream
+ @initial_pos = @stream.pos
+ end
+
+ def should_stop(pos)
+ @stream.eof?
end
def boxes
Enumerator.new do |e|
- cur_pos = 0
- until @stream.eof?
+ cur_pos = @initial_pos
+ until should_stop(@stream.pos)
@stream.seek cur_pos
box = FileData::Box.new
@@ -22,26 +27,14 @@ end
end
- class BoxSubStream
+ class BoxSubStream < BoxStream
def initialize(stream, parent_box)
- @stream = stream
+ super(stream)
@parent_box = parent_box
end
- def boxes
- initial_pos = @stream.pos
- Enumerator.new do |e|
- cur_pos = @stream.pos
- until cur_pos >= initial_pos + @parent_box.size
- @stream.seek cur_pos
-
- box = FileData::Box.new
- box.read(@stream)
-
- e.yield box
- cur_pos += box.size
- end
- end.lazy
+ def should_stop(pos)
+ pos >= @initial_pos + @parent_box.size
end
end
end
| Remove some of the duplication in BoxStream and BoxSubStream by using inheritance
|
diff --git a/lib/rom/sql/repository.rb b/lib/rom/sql/repository.rb
index abc1234..def5678 100644
--- a/lib/rom/sql/repository.rb
+++ b/lib/rom/sql/repository.rb
@@ -6,7 +6,7 @@ module ROM
module SQL
class Repository < ROM::Repository
- attr_reader :logger
+ attr_reader :logger, :schema
def self.database_file?(scheme)
scheme.to_s.include?('sqlite')
@@ -14,6 +14,7 @@
def initialize(uri, options = {})
@connection = ::Sequel.connect(uri.to_s, options)
+ @schema = connection.tables
end
def disconnect
@@ -27,10 +28,6 @@ def use_logger(logger)
@logger = logger
connection.loggers << logger
- end
-
- def schema
- connection.tables
end
def dataset(table)
| Store schema in an ivar
|
diff --git a/lib/leaflet-draw-rails.rb b/lib/leaflet-draw-rails.rb
index abc1234..def5678 100644
--- a/lib/leaflet-draw-rails.rb
+++ b/lib/leaflet-draw-rails.rb
@@ -5,6 +5,10 @@ RSpec.configure do |spec|
spec.include Leaflet::Draw::Rails::Testing
end
+end
+
+if respond_to? :World
+ World Leaflet::Draw::Rails::Testing
end
module Leaflet
| Make the testing helpers visible in cucumber step definitions.
|
diff --git a/lib/ssbe_authenticator.rb b/lib/ssbe_authenticator.rb
index abc1234..def5678 100644
--- a/lib/ssbe_authenticator.rb
+++ b/lib/ssbe_authenticator.rb
@@ -15,7 +15,7 @@
def update_credentials(challenge_response)
@domain = Addressable::URI.parse(challenge_response.uri).host
- @challenge = HTTPAuth::Digest::Challenge.from_header(challenge_response.header['WWW-Authenticate'].first)
+ @challenge = HTTPAuth::Digest::Challenge.from_header(challenge_response.header['WWW-Authenticate'].join(", "))
end
def valid_for?(challenge_response)
@@ -25,7 +25,8 @@ rescue HTTPAuth::UnwellformedHeader
return false
end
- challenge.realm == @realm
+ #challenge.realm == @realm
+ true
end
def can_handle?(request)
| Update for new resourceful header style
|
diff --git a/Nimble.podspec b/Nimble.podspec
index abc1234..def5678 100644
--- a/Nimble.podspec
+++ b/Nimble.podspec
@@ -15,4 +15,5 @@ s.source_files = "Nimble", "Nimble/**/*.{swift,h,m}"
s.framework = "XCTest"
s.requires_arc = true
+ s.pod_target_xcconfig = { 'ENABLE_BITCODE' => 'NO' }
end
| Add ENABLE_BITCODE = NO in podspec.
This was added to the Nimble.xcodeproj, but was forgotten in the
xcodeproj.
Fixes #170.
|
diff --git a/core/enumerator/lazy/fixtures/classes.rb b/core/enumerator/lazy/fixtures/classes.rb
index abc1234..def5678 100644
--- a/core/enumerator/lazy/fixtures/classes.rb
+++ b/core/enumerator/lazy/fixtures/classes.rb
@@ -0,0 +1,50 @@+# -*- encoding: us-ascii -*-
+
+module EnumeratorLazySpecs
+ class SpecificError < Exception; end
+
+ class YieldsMixed
+ def self.initial_yields
+ [nil, 0, 0, 0, 0, nil, :default_arg, [], [], [0], [0, 1], [0, 1, 2]]
+ end
+
+ def self.gathered_yields
+ [nil, 0, [0, 1], [0, 1, 2], [0, 1, 2], nil, :default_arg, [], [], [0], [0, 1], [0, 1, 2]]
+ end
+
+ def self.gathered_yields_with_args(arg, *args)
+ [nil, 0, [0, 1], [0, 1, 2], [0, 1, 2], nil, arg, args, [], [0], [0, 1], [0, 1, 2]]
+ end
+
+ def each(arg=:default_arg, *args)
+ yield
+ yield 0
+ yield 0, 1
+ yield 0, 1, 2
+ yield(*[0, 1, 2])
+ yield nil
+ yield arg
+ yield args
+ yield []
+ yield [0]
+ yield [0, 1]
+ yield [0, 1, 2]
+ end
+ end
+
+ class EventsMixed
+ def each
+ ScratchPad << :before_yield
+
+ yield 0
+
+ ScratchPad << :after_yield
+
+ raise SpecificError
+
+ ScratchPad << :after_error
+
+ :should_not_reach_here
+ end
+ end
+end
| Write spec fixtures for Enumerator::Lazy
|
diff --git a/app/models/email_signup_pages_finder.rb b/app/models/email_signup_pages_finder.rb
index abc1234..def5678 100644
--- a/app/models/email_signup_pages_finder.rb
+++ b/app/models/email_signup_pages_finder.rb
@@ -9,19 +9,16 @@ def self.mhra_email_signup_pages
[
OpenStruct.new(
- text: "Safety alerts",
- url: "/drug-device-alerts/email-signup",
- description: "Drug alerts and medical device alerts published by the MHRA.",
+ text: "Drug alerts and medical device alerts",
+ description: "Subscribe to <a href='/drug-device-alerts/email-signup'>MHRA's alerts and recalls for drugs and medical devices</a>.".html_safe,
),
OpenStruct.new(
- text: "Drug safety updates",
- url: "/drug-safety-update/email-signup",
- description: "The drug safety update is a monthly newsletter for healthcare professionals, bringing you information and clinical advice on the safe use of medicines.",
+ text: "Drug Safety Update",
+ description: "Subscribe to the <a href='/drug-safety-update/email-signup'>Drug Safety Update</a>, the monthly newsletter for healthcare professionals, with clinical advice on the safe use of medicines.".html_safe,
),
OpenStruct.new(
text: "News and publications from the MHRA",
- url: "/government/email-signup/new?email_signup%5Bfeed%5D=https%3A%2F%2Fwww.gov.uk%2Fgovernment%2Forganisations%2Fmedicines-and-healthcare-products-regulatory-agency.atom",
- description: "Information published by the MHRA about policies, announcements, publications, statistics and consultations.",
+ description: "Subscribe to <a href='/government/email-signup/new?email_signup%5Bfeed%5D=https%3A%2F%2Fwww.gov.uk%2Fgovernment%2Forganisations%2Fmedicines-and-healthcare-products-regulatory-agency.atom'>MHRA's new publications, statistics, consultations and announcements</a>.".html_safe,
),
]
end
| Update copy for MHRA email alerts
Make the copy for this page match the prototype.
|
diff --git a/lib/usesthis/interview.rb b/lib/usesthis/interview.rb
index abc1234..def5678 100644
--- a/lib/usesthis/interview.rb
+++ b/lib/usesthis/interview.rb
@@ -14,10 +14,10 @@
begin
contents = File.read(path)
- parts = contents.match(/---\n(.*)\n---\n(.*)/m)
+ parts = contents.match(/^(-{3}\n.*?\n?)^(-{3}*$\n?)/m)
metadata = YAML::load(parts[1])
- @answers = parts[2].strip
+ @answers = parts.post_match.strip!
%w(name summary categories credits).each do |item|
self.send("#{item}=", metadata[item])
| Use this frontmatter method totally borrowed from the Internets.
|
diff --git a/lib/wkhtmltopdf-heroku.rb b/lib/wkhtmltopdf-heroku.rb
index abc1234..def5678 100644
--- a/lib/wkhtmltopdf-heroku.rb
+++ b/lib/wkhtmltopdf-heroku.rb
@@ -15,3 +15,12 @@ WickedPdf.config[:exe_path] = WKHTMLTOPDF_PATH
rescue LoadError
end
+
+begin
+ require 'wisepdf'
+
+ Wisepdf::Configuration.configure do |config|
+ config.wkhtmltopdf = WKHTMLTOPDF_PATH
+ end
+rescue LoadError
+end
| Add hook in for Wisepdf.
|
diff --git a/app/services/location_lookup_service.rb b/app/services/location_lookup_service.rb
index abc1234..def5678 100644
--- a/app/services/location_lookup_service.rb
+++ b/app/services/location_lookup_service.rb
@@ -49,7 +49,7 @@
def response
@response ||= begin
- JSON.parse(GdsApi.mapit.location_for_postcode(postcode).to_json)
+ JSON.parse(mapit.location_for_postcode(postcode).to_json)
rescue GdsApi::HTTPNotFound, GdsApi::HTTPClientError => e
{
error: {
@@ -59,4 +59,10 @@ }
end
end
+
+ def mapit
+ return GdsApi.mapit unless Rails.env.development?
+
+ GdsApi::Mapit.new("https://mapit.mysociety.org/")
+ end
end
| Use My Society's Mapit when running locally
GOV.UK hosts it's own version of Mapit. Unfortunately, that is only accessibly via the production
and test environments, not locally. Until we can access Mapit locally, add a work around to make it
possibly to manually test changes.
|
diff --git a/lib/rbbt/util/tsv/misc.rb b/lib/rbbt/util/tsv/misc.rb
index abc1234..def5678 100644
--- a/lib/rbbt/util/tsv/misc.rb
+++ b/lib/rbbt/util/tsv/misc.rb
@@ -29,3 +29,13 @@ counts
end
end
+
+module Open
+ def self.tsv(file, *args)
+ TSV.new file, *args
+ end
+
+ def self.index(file, *args)
+ TSV.index file, *args
+ end
+end
| Add 2 more methods to Open: tsv and index
|
diff --git a/lib/rdbi/driver/rubyfb.rb b/lib/rdbi/driver/rubyfb.rb
index abc1234..def5678 100644
--- a/lib/rdbi/driver/rubyfb.rb
+++ b/lib/rdbi/driver/rubyfb.rb
@@ -1,6 +1,12 @@ require 'rdbi'
require 'rubyfb'
+##
+#
+# RDBI database driver for the robust and SQL-compliant Firebird RDBMS, an
+# open-source member of the InterBase genus. See the documentation for
+# RDBI::Driver::Rubyfb::Database for more information.
+#
class RDBI::Driver::Rubyfb < RDBI::Driver
def initialize(*args)
super(Database, *args)
| Add preamble doc to RDBI::Driver::Rubyfb
|
diff --git a/rubio.gemspec b/rubio.gemspec
index abc1234..def5678 100644
--- a/rubio.gemspec
+++ b/rubio.gemspec
@@ -18,6 +18,7 @@ gem.add_runtime_dependency('hashie') # Hash method access
gem.add_runtime_dependency('httparty') # Used to tell Rdio to let us in
gem.add_runtime_dependency('activesupport', '~> 3.2') # Hash method access
+ gem.add_runtime_dependency('oauth')
gem.add_development_dependency('rspec') # Because who likes TestUnit really?
gem.add_development_dependency('awesome_print') # Pretty debugging
| Update gemspec to reinclude OAuth, sweet jesus.
|
diff --git a/data-aggregation-accumulator.gemspec b/data-aggregation-accumulator.gemspec
index abc1234..def5678 100644
--- a/data-aggregation-accumulator.gemspec
+++ b/data-aggregation-accumulator.gemspec
@@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = 'data_aggregation-accumulator'
- s.version = '0.0.1.1'
+ s.version = '0.1.0.0'
s.summary = 'Data aggregation accumulator library'
s.description = ' '
| Package version is increased from 0.0.1.1 to 0.1.0.0
|
diff --git a/lib/render_menu_helper.rb b/lib/render_menu_helper.rb
index abc1234..def5678 100644
--- a/lib/render_menu_helper.rb
+++ b/lib/render_menu_helper.rb
@@ -1,13 +1,15 @@ module ActionView
class Base
- def render_menu(dynamic_menu)
+ def render_menu(dynamic_menu, *args)
raise 'No DynamicMenu or Item Object' unless dynamic_menu.instance_of?(DynamicMenu) or dynamic_menu.instance_of?(Item)
+ options = args.last.is_a?(Hash) ? args.last : {}
+ model = options[:model] || [:ul, :li]
- content_tag :ul do
+ content_tag model.first do
dynamic_menu.items.map do |menu_item|
- content_tag :li, (link_to menu_item[:name], menu_item[:target]) + (menu_item.items.empty? ? '' : render_menu(menu_item))
- end.flatten.compact.join
+ content_tag model.last, (link_to menu_item[:name], menu_item[:target]) + (menu_item.items.empty? ? '' : render_menu(menu_item, *args))
+ end
end
end
| Add model instruction for render_menu method
|
diff --git a/slack-danbot/commands/info.rb b/slack-danbot/commands/info.rb
index abc1234..def5678 100644
--- a/slack-danbot/commands/info.rb
+++ b/slack-danbot/commands/info.rb
@@ -3,7 +3,7 @@ class Info < SlackRubyBot::Commands::Base
command 'get_basic_info' do |client, data, _match|
- client.say(channel: data.channel, text: "TESTING")
+ client.say(channel: data.channel, text: "TESTING!")
end
command 'get_blurb' do |client, data, _math|
| Make test commit for BeepBoop
|
diff --git a/app/controllers/spree/admin/postage_labels_controller.rb b/app/controllers/spree/admin/postage_labels_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/spree/admin/postage_labels_controller.rb
+++ b/app/controllers/spree/admin/postage_labels_controller.rb
@@ -13,7 +13,7 @@ return
end
- redirect_to @shipment.easypost_postage_label_url
+ redirect_to @shipment.easypost_postage_label_url, allow_other_host: true
end
end
end
| Fix redirect when Rails' `raise_on_open_redirect` is true
That is the new default on Rails 7. We need to be explicit to allow
redirecting to an external host.
See https://api.rubyonrails.org/classes/ActionController/Redirecting.html#method-i-redirect_to-label-Open+Redirect+protection
|
diff --git a/lib/samuel.rb b/lib/samuel.rb
index abc1234..def5678 100644
--- a/lib/samuel.rb
+++ b/lib/samuel.rb
@@ -21,10 +21,13 @@ @logger = nil if !defined?(@logger)
return @logger if !@logger.nil?
- if defined?(RAILS_DEFAULT_LOGGER)
- @logger = RAILS_DEFAULT_LOGGER
- else
- @logger = Logger.new(STDOUT)
+ @logger = case
+ when defined?(Rails) && Rails.respond_to?('logger')
+ Rails.logger
+ when defined?(RAILS_DEFAULT_LOGGER)
+ RAILS_DEFAULT_LOGGER
+ else
+ Logger.new(STDOUT)
end
end
| Use Rails.logger when available (fix deprecation warning in Rails 3.x)
|
diff --git a/lib/ci_in_a_can/bash_result.rb b/lib/ci_in_a_can/bash_result.rb
index abc1234..def5678 100644
--- a/lib/ci_in_a_can/bash_result.rb
+++ b/lib/ci_in_a_can/bash_result.rb
@@ -1,5 +1,13 @@ module CiInACan
+
class BashResult
+
attr_accessor :exit_code, :output
+
+ def success
+ exit_code == 0
+ end
+
end
+
end
| Add a method to be able to determine if the call was successful or not.
|
diff --git a/spec/reel/unix_server_spec.rb b/spec/reel/unix_server_spec.rb
index abc1234..def5678 100644
--- a/spec/reel/unix_server_spec.rb
+++ b/spec/reel/unix_server_spec.rb
@@ -17,22 +17,16 @@ end
end
-=begin
Dir::Tmpname.create('reel-sock') do |path|
begin
-
- sock = Net::BufferedIO.new UNIXSocket.new(path)
+ server = Reel::Server::UNIX.new(path, &handler)
+ sock = Net::BufferedIO.new Celluloid::IO::UNIXSocket.new(path)
request = Net::HTTP::Get.new('/')
- server = Reel::Server::UNIX.new(sock, &handler)
- yield server
-
request.exec(sock, '1.1', path)
-
ensure
server.terminate if server && server.alive?
end
-=end
end
end
| Fix broken UNIX server test
|
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -22,7 +22,7 @@ # Rails' instrumentation code, and is run after each request.
def append_info_to_payload(payload)
super
- if @extra_log_items
+ if @custom_log_items
payload[:custom_log_items] = @custom_log_items
end
end
| Fix output of custom log attributes
|
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -2,11 +2,13 @@ protect_from_forgery with: :exception
force_ssl if: :ssl_configured?
- ALLOWED_ROLES = ['admin'].freeze
+ ADMIN_ROLE = 'marketing_db_admin'.freeze
+ ALLOWED_GRAVITY_ROLES = ['admin', ADMIN_ROLE].freeze
def authorized_artsy_token?(token)
- roles = user_roles(token)
- success_or_die(roles)
+ @roles = user_roles(token)
+ @is_admin = admin?
+ success_or_die
end
def user_roles(token)
@@ -17,15 +19,19 @@
private
+ def admin?
+ @roles.include? ADMIN_ROLE
+ end
+
def ssl_configured?
!Rails.env.development?
end
- def role_permitted?(roles)
- roles.any? { |role| ALLOWED_ROLES.member? role }
+ def role_permitted?
+ @roles.any? { |role| ALLOWED_GRAVITY_ROLES.member? role }
end
- def success_or_die(roles)
- role_permitted?(roles) || render(plain: '404 Not Found', status: 404)
+ def success_or_die
+ role_permitted? || render(plain: '404 Not Found', status: 404)
end
end
| Add `is_admin` instance var for permission fun
|
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/admin_controller.rb
+++ b/app/controllers/admin_controller.rb
@@ -6,11 +6,13 @@ private
def require_user
- redirect_to '/auth/google_oauth2' unless session[:user_id]
+ redirect_to '/auth/google_oauth2' unless current_user
end
helper_method def current_user
@current_user ||= User.find(session[:user_id])
+ rescue
+ nil
end
end
| Check the current user instead of just the session id
|
diff --git a/gems/pending/util/extensions/miq-yaml.rb b/gems/pending/util/extensions/miq-yaml.rb
index abc1234..def5678 100644
--- a/gems/pending/util/extensions/miq-yaml.rb
+++ b/gems/pending/util/extensions/miq-yaml.rb
@@ -6,11 +6,13 @@ module Psych
module Visitors
class ToRuby
+ SHOVEL = '<<'
+ IVAR_MARKER = '__iv__'
def revive_hash hash, o
o.children.each_slice(2) { |k,v|
key = accept(k)
- if key == '<<'.freeze
+ if key == SHOVEL
case v
when Nodes::Alias
hash.merge! accept(v)
@@ -24,7 +26,7 @@
# We need to migrate all old YAML before we can remove this
#### Reapply the instance variables, see https://github.com/tenderlove/psych/issues/43
- elsif key.to_s[0..5] == "__iv__".freeze
+ elsif key.to_s[0..5] == IVAR_MARKER
hash.instance_variable_set(key.to_s[6..-1], accept(v))
else
| Use constants for these strings instead of freezing them.
Reworked #4371 based on: https://github.com/tenderlove/psych/pull/249
|
diff --git a/app/graphql/types/connection_data_type.rb b/app/graphql/types/connection_data_type.rb
index abc1234..def5678 100644
--- a/app/graphql/types/connection_data_type.rb
+++ b/app/graphql/types/connection_data_type.rb
@@ -2,11 +2,7 @@ name 'ConnectionData'
description 'Common type to fetch fields for various connections'
interfaces [GraphQL::Relay::Node.interface]
- global_id_field :answer_id
-
- field :id, !types.ID, 'id of this import' do
- resolve ->(obj, _args, _ctx) { pick_field(obj, id_fields) }
- end
+ global_id_field :id
field :title, types.String, 'title of this import' do
resolve ->(obj, _args, _ctx) { pick_field(obj, title_fields) }
@@ -46,7 +42,3 @@ def title_fields
%w(title name)
end
-
-def id_fields
- %w(Id id answer_id)
-end
| Use regular id field as answers response is fixed
|
diff --git a/lib/foundation_rails_helper/flash_helper.rb b/lib/foundation_rails_helper/flash_helper.rb
index abc1234..def5678 100644
--- a/lib/foundation_rails_helper/flash_helper.rb
+++ b/lib/foundation_rails_helper/flash_helper.rb
@@ -16,7 +16,7 @@ key_matching = DEFAULT_KEY_MATCHING.merge(key_matching)
flash.inject "" do |message, (key, value)|
- message += content_tag :div, :class => "alert-box #{key_matching[key] || :standard}" do
+ message += content_tag :div, :data => { :alert => "" }, :class => "alert-box #{key_matching[key] || :standard}" do
(value + link_to("×".html_safe, "#", :class => :close)).html_safe
end
end.html_safe
| Add data-alert attribute to content_tag
|
diff --git a/test/support/effective_test_bot_login_helper.rb b/test/support/effective_test_bot_login_helper.rb
index abc1234..def5678 100644
--- a/test/support/effective_test_bot_login_helper.rb
+++ b/test/support/effective_test_bot_login_helper.rb
@@ -7,6 +7,10 @@
def sign_in(user) # Warden::Test::Helpers
user.kind_of?(String) ? login_as(User.find_by_email!(user)) : login_as(user)
+ end
+
+ def sign_out
+ logout
end
def sign_in_manually(user_or_email, password = nil)
| Add sign_out as an alias for logout
|
diff --git a/lib/low_voltage/post_finder.rb b/lib/low_voltage/post_finder.rb
index abc1234..def5678 100644
--- a/lib/low_voltage/post_finder.rb
+++ b/lib/low_voltage/post_finder.rb
@@ -1,5 +1,10 @@ module LowVoltage
- class PostFinder < HighVoltage::PageFinder
+ class PostFinder
+ VALID_CHARACTERS = "a-zA-Z0-9~!@$%^&*()#`_+-=<>\"{}|[];',?".freeze
+
+ def initialize(post_id)
+ @post_id = post_id
+ end
def find
Rails.root.join("app/views/#{content_path}/#{clean_path}.md")
@@ -9,5 +14,21 @@ LowVoltage.configuration.content_path
end
+ protected
+
+ # The raw page id passed in by the user
+ attr_reader :post_id
+
+ private
+
+ def clean_path
+ path = Pathname.new("/#{clean_id}")
+ path.cleanpath.to_s[1..-1]
+ end
+
+ def clean_id
+ @post_id.tr("^#{VALID_CHARACTERS}", '')
+ end
+
end
end
| Rewrite post finder to not extend HighVoltage::PageFinder.
|
diff --git a/lib/reports/published_attachments_report.rb b/lib/reports/published_attachments_report.rb
index abc1234..def5678 100644
--- a/lib/reports/published_attachments_report.rb
+++ b/lib/reports/published_attachments_report.rb
@@ -1,7 +1,7 @@ module Reports
class PublishedAttachmentsReport
def report
- path = Rails.root.join("tmp/attachments_#{Time.zone.now.strftime('%d-%m-%Y_%H-%M')}.csv")
+ path = "/tmp/attachments_#{Time.zone.now.strftime('%d-%m-%Y_%H-%M')}.csv"
csv_headers = ["Organisation", "Filename", "Filetype", "Published Date"]
attachments = Attachment.find_by_sql([
| Fix path for attachment report directory
A slash was missed from the start of the path, so the output file for
the published attachment report was being written to the application
deployment directory, rather than the machine's /tmp directory.
|
diff --git a/lib/smart_answer/question/country_select.rb b/lib/smart_answer/question/country_select.rb
index abc1234..def5678 100644
--- a/lib/smart_answer/question/country_select.rb
+++ b/lib/smart_answer/question/country_select.rb
@@ -1,10 +1,9 @@ module SmartAnswer
module Question
- class CountrySelect < MultipleChoice
+ class CountrySelect < Base
def initialize(name, options = {}, &block)
@include_uk = options.delete(:include_uk)
@use_legacy_data = options.delete(:use_legacy_data)
- options = country_list
super(name, options, &block)
end
@@ -20,6 +19,11 @@ options.map{|v| v.slug}.include? (option.to_s)
end
+ def parse_input(raw_input)
+ raise SmartAnswer::InvalidResponse, "Illegal option #{raw_input} for #{name}", caller unless valid_option?(raw_input)
+ super
+ end
+
private
def load_countries
| Fix the CountrySelect initialize to not load options
This was unnecessary and seemed to be incorrect, maybe a hangover from
inheriting from MultipleChoice. This change means it doesn't need to
load the countries from the API on initialise, which means it doesn't
need to load them when registering with Panopticon... which is nice.
It no longer inherits form MultipleChoice as there was no real reason to.
|
diff --git a/app/services/pages_core/invite_service.rb b/app/services/pages_core/invite_service.rb
index abc1234..def5678 100644
--- a/app/services/pages_core/invite_service.rb
+++ b/app/services/pages_core/invite_service.rb
@@ -14,8 +14,8 @@ end
class << self
- def call(*attrs)
- new(*attrs).call
+ def call(attrs, user:, host:, protocol: "http")
+ new(attrs, user: user, host: host, protocol: protocol).call
end
end
| Use explicit attributes in InviteService.call
|
diff --git a/lib/renalware/configuration.rb b/lib/renalware/configuration.rb
index abc1234..def5678 100644
--- a/lib/renalware/configuration.rb
+++ b/lib/renalware/configuration.rb
@@ -22,7 +22,7 @@ config_accessor(:salutation_prefix) { "Dear" }
config_accessor(:page_title_spearator) { " : " }
config_accessor(:patient_hospital_identifiers) { {} }
- config_accessor(:session_timeout_polling_frequency) { 15.seconds }
+ config_accessor(:session_timeout_polling_frequency) { 1.minute }
config_accessor(:duration_of_last_url_memory_after_session_expiry) { 30.minutes }
config_accessor(:broadcast_subscription_map) { {} }
config_accessor(:include_sunday_on_hd_diaries) { false }
| Change session expired polling freq to 1 min
To reduce noise in logs
|
diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb
index abc1234..def5678 100644
--- a/spec/helpers/application_helper_spec.rb
+++ b/spec/helpers/application_helper_spec.rb
@@ -0,0 +1,22 @@+require 'spec_helper'
+
+# Specs in this file have access to a helper object that includes
+# the ChallengesHelper. For example:
+#
+# describe ChallengesHelper do
+# describe "string concat" do
+# it "concats two strings with spaces" do
+# expect(helper.concat_strings("this","that")).to eq("this that")
+# end
+# end
+# end
+describe ApplicationHelper do
+ describe 'within_team_registration_period?' do
+ end
+
+ describe 'within_contest_period?' do
+ end
+
+ describe 'markdown_render' do
+ end
+end
| Add stub for ApplicationHelper spec.
|
diff --git a/spec/lib/tasks/after_precompile_spec.rb b/spec/lib/tasks/after_precompile_spec.rb
index abc1234..def5678 100644
--- a/spec/lib/tasks/after_precompile_spec.rb
+++ b/spec/lib/tasks/after_precompile_spec.rb
@@ -34,7 +34,6 @@ end
after do
- Rake::Task["assets:clobber"].execute
FileUtils.rm_r(Dir.glob(Rails.public_path.join("*")), secure: true)
end
end
| Remove a redundant execution of rake task
|
diff --git a/lib/stripe/bitcoin_receiver.rb b/lib/stripe/bitcoin_receiver.rb
index abc1234..def5678 100644
--- a/lib/stripe/bitcoin_receiver.rb
+++ b/lib/stripe/bitcoin_receiver.rb
@@ -10,7 +10,7 @@ end
def url
- if respond_to?(:customer)
+ if respond_to?(:customer) && !self.customer.nil?
"#{Customer.url}/#{CGI.escape(customer)}/sources/#{CGI.escape(id)}"
else
"#{self.class.url}/#{CGI.escape(id)}"
| Check for nil customer value when determining bitcoin receiver URL
Stripe API responses include `customer: nil`, which causes `refresh`
to throw an exception
|
diff --git a/spec/lib/use_case/question/create_followers_spec.rb b/spec/lib/use_case/question/create_followers_spec.rb
index abc1234..def5678 100644
--- a/spec/lib/use_case/question/create_followers_spec.rb
+++ b/spec/lib/use_case/question/create_followers_spec.rb
@@ -0,0 +1,29 @@+# frozen_string_literal: true
+
+require "rails_helper"
+require "errors"
+require "use_case/question/create_followers"
+
+describe UseCase::Question::CreateFollowers do
+ subject do
+ UseCase::Question::CreateFollowers.call(
+ source_user_id: source_user.id,
+ content: content,
+ author_identifier: author_identifier
+ )
+ end
+
+ context "user is logged in" do
+ let(:source_user) { create(:user) }
+ let(:content) { "content" }
+ let(:author_identifier) { nil }
+
+ it "creates question" do
+ expect(subject[:question]).to be_persisted
+ end
+
+ it "enqueues a QuestionWorker job" do
+ expect(QuestionWorker).to have_enqueued_sidekiq_job(source_user.id, subject[:question].id)
+ end
+ end
+end
| Add tests for question create followers use case
|
diff --git a/BartyCrouch.podspec b/BartyCrouch.podspec
index abc1234..def5678 100644
--- a/BartyCrouch.podspec
+++ b/BartyCrouch.podspec
@@ -2,12 +2,12 @@
s.name = "BartyCrouch"
s.version = "4.0.1"
- s.summary = "Localization/I18n: Incrementally update your Strings files from .swift, .h, .m(m), .storyboard or .xib files."
+ s.summary = "Localization/I18n: Incrementally update/translate your Strings files from .swift, .h, .m(m), .storyboard or .xib files."
s.description = <<-DESC
BartyCrouch incrementally updates your Strings files from your Code and from Interface Builder files. "Incrementally" means that
- BartyCrouch will by default keep both your already translated values and even your altered comments. Additionally you can also
- use BartyCrouch for machine translating from one language to 40+ other languages. Using BartyCrouch is as easy as running a few
+ BartyCrouch will by default keep both your already translated values and even your altered comments. Additionally you can also use
+ BartyCrouch for machine translating from one language to 60+ other languages. Using BartyCrouch is as easy as running a few
simple commands from the command line what can even be automated using a build script within your project.
DESC
| Update description & summary in podspec
|
diff --git a/app/controllers/admin/posts_controller.rb b/app/controllers/admin/posts_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/admin/posts_controller.rb
+++ b/app/controllers/admin/posts_controller.rb
@@ -33,7 +33,7 @@
private
def post_params
- params.permit(:id, post: [:author, :published, :published_at, :content])
+ params.permit(:id, post: [:title, :author, :published, :published_at, :content])
end
end
| Add title to allowed parameters
|
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -1,5 +1,5 @@ class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
- protect_from_forgery with: :exception
+ protect_from_forgery with: :null_session
end
| Save us, null_session, you're our only hope
|
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -11,10 +11,10 @@ end
def authorize_user
- redirect_to :back, error: "You can't perform this action" unless current_user.present?
+ redirect_to :back, error: "You can't perform this action" unless current_user.present? && current_user.moderator?
end
def authorize_super_admin
- redirect_to :back, error: "You can't perform this action" unless current_user.present?
+ redirect_to :back, error: "You can't perform this action" unless current_user.present? && current_user.super_admin?
end
end
| Fix Bug in authorize methods
|
diff --git a/lib/spree_paypal_express.rb b/lib/spree_paypal_express.rb
index abc1234..def5678 100644
--- a/lib/spree_paypal_express.rb
+++ b/lib/spree_paypal_express.rb
@@ -7,7 +7,6 @@ config.autoload_paths += %W(#{config.root}/lib)
def self.activate
- debugger
Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
Rails.env.production? ? require(c) : load(c)
end
| Remove debugger statement accidentally left in ff443b2
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.