diff
stringlengths 65
26.7k
| message
stringlengths 7
9.92k
|
|---|---|
diff --git a/spec/scanny/checks/session/session_secure_check_spec.rb b/spec/scanny/checks/session/session_secure_check_spec.rb
index abc1234..def5678 100644
--- a/spec/scanny/checks/session/session_secure_check_spec.rb
+++ b/spec/scanny/checks/session/session_secure_check_spec.rb
@@ -6,14 +6,6 @@ @runner = Scanny::Runner.new(SessionSecureCheck.new)
@message = "Bad session security setting can cause problems"
@issue = issue(:info, @message, 614)
- end
-
- it "reports \":session_secure\" correctly" do
- @runner.should check(":session_secure").with_issue(@issue)
- end
-
- it "reports \":secure\" correctly" do
- @runner.should check(":secure").with_issue(@issue)
end
it "reports \"ActionController::Base.session_options[:session_secure] = false\" correctly" do
|
Remove spec with simple symbols
|
diff --git a/lib/rails_admin/adapters/mongoid/extension.rb b/lib/rails_admin/adapters/mongoid/extension.rb
index abc1234..def5678 100644
--- a/lib/rails_admin/adapters/mongoid/extension.rb
+++ b/lib/rails_admin/adapters/mongoid/extension.rb
@@ -39,7 +39,8 @@ args.each do |arg|
@nested_attributes_options[arg.to_sym] = options.reverse_merge(:allow_destroy=>false, :update_only=>false)
end
- accepts_nested_attributes_for_without_rails_admin(*args, options)
+ args << options
+ accepts_nested_attributes_for_without_rails_admin(*args)
end
end
end
|
Fix syntax error in Ruby1.8
|
diff --git a/lib/tasks/data_migrations/add_pic_school.rake b/lib/tasks/data_migrations/add_pic_school.rake
index abc1234..def5678 100644
--- a/lib/tasks/data_migrations/add_pic_school.rake
+++ b/lib/tasks/data_migrations/add_pic_school.rake
@@ -1,5 +1,5 @@ namespace :data_migration do
- desc "Add Capuano school"
+ desc "Add Parent Information Center school"
task add_pic: :environment do
School.create(local_id: "PIC", name: "Parent Information Center")
end
|
Fix description for Parent Information Center school
|
diff --git a/scripts/npm_bundles.rb b/scripts/npm_bundles.rb
index abc1234..def5678 100644
--- a/scripts/npm_bundles.rb
+++ b/scripts/npm_bundles.rb
@@ -7,6 +7,7 @@ "coffee-script" => "coffee",
"grunt-cli" => "grunt",
"dalek-cli" => "dalek",
+ "gulp" => "",
"gh" => "",
"bower" => "",
"yo" => "",
|
Add gulp to npm packages
|
diff --git a/test/test_helper.rb b/test/test_helper.rb
index abc1234..def5678 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -21,12 +21,12 @@ client.instance_variable_set('@instance_host', 'na9.salesforce.com')
end
- def fixture_path
- File.expand_path("../fixtures", __FILE__)
+ def fixture_path(file)
+ File.expand_path("../fixtures/#{file}", __FILE__)
end
def fixture(file)
- File.new(fixture_path + '/' + file).read
+ File.new(fixture_path(file)).read
end
end
|
Update fixture_path helper to take a file name that way we can use it separately if necessary. We'll need it for our YAML config implementation test.
|
diff --git a/app/models/auth_token.rb b/app/models/auth_token.rb
index abc1234..def5678 100644
--- a/app/models/auth_token.rb
+++ b/app/models/auth_token.rb
@@ -1,9 +1,55 @@ class AuthToken < ActiveRecord::Base
+
+ belongs_to :user
# Auth token encryption settings
attr_encrypted :auth_token,
key: Doubtfire::Application.secrets.secret_key_attr,
encode: true,
attribute: 'authentication_token'
-
+
+ def self.generate(user, remember)
+ # Loop until new unique auth token is found
+ token = loop do
+ token = Devise.friendly_token
+ break token unless AuthToken.find_by_auth_token(token)
+ end
+
+ # Create a new AuthToken with this value
+ result = AuthToken.new(user_id: user.id)
+ result.auth_token = token
+ result.extend_token(remember, false)
+ result.save!
+ result
+ end
+
+ #
+ # Extends an existing auth_token if needed
+ #
+ def extend_token(remember, save = true)
+ # Default expire time
+ expiry_time = Time.zone.now + 2.hours
+
+ # Extended expiry times only apply to students and convenors
+ if remember
+ student_expiry_time = Time.zone.now + 2.weeks
+ tutor_expiry_time = Time.zone.now + 1.week
+ role = user.role
+ expiry_time =
+ if role == Role.student || role == :student
+ student_expiry_time
+ elsif role == Role.tutor || role == :tutor
+ tutor_expiry_time
+ else
+ expiry_time
+ end
+ end
+
+ if save
+ self.update(auth_token_expiry: expiry_time)
+ else
+ self.auth_token_expiry = expiry_time
+ end
+ end
+
end
|
QUALITY: Move generation of auth token to auth token class
|
diff --git a/oc-chef-pedant/spec/running_configs/analytics_spec.rb b/oc-chef-pedant/spec/running_configs/analytics_spec.rb
index abc1234..def5678 100644
--- a/oc-chef-pedant/spec/running_configs/analytics_spec.rb
+++ b/oc-chef-pedant/spec/running_configs/analytics_spec.rb
@@ -0,0 +1,48 @@+require 'json'
+require 'pedant/rspec/common'
+
+describe 'running configs required by Analytics Server', :config do
+ #
+ # The analyics add-on reads from actions-source.json which is only
+ # written out in some configurations.
+ #
+ running_config = JSON.parse(IO.read('/etc/opscode/chef-server-running.json'))
+ if running_config['insecure_addon_compat'] && running_config['darklaunch']['actions']
+ skip 'Analytics config is only written when insecure_addon_compat = true && darklaunch["actions"] = true'
+ else
+ let(:actions_source) { JSON.parse(IO.read('/etc/opscode-analytics/actions-source.json')) }
+ let(:config) { actions_source['private_chef'] }
+
+ it 'api_fqdn' do
+ expect(config['api_fqdn'].to_s).to_not eq('')
+ end
+
+ it 'oc_id_application' do
+ expect(config['oc_id_application'].class).to eq(Hash)
+ end
+
+ it 'rabbitmq_host' do
+ expect(config['rabbitmq_host'].to_s).to_not eq('')
+ end
+
+ it 'rabbitmq_port' do
+ expect(config['rabbitmq_port'].to_i).to_not eq(0)
+ end
+
+ it 'rabbitmq_vhost' do
+ expect(config['rabbitmq_vhost'].to_s).to_not eq('')
+ end
+
+ it 'rabbitmq_exchange' do
+ expect(config['rabbitmq_exchange'].to_s).to_not eq('')
+ end
+
+ it 'rabbitmq_user' do
+ expect(config['rabbitmq_user'].to_s).to_not eq('')
+ end
+
+ it 'rabbitmq_password' do
+ expect(config['rabbitmq_password'].to_s).to_not eq('')
+ end
+ end
+end
|
[pedant] Add specs for analytics-required config exports
Signed-off-by: Steven Danna <9ce5770b3bb4b2a1d59be2d97e34379cd192299f@chef.io>
|
diff --git a/test/test_as_json.rb b/test/test_as_json.rb
index abc1234..def5678 100644
--- a/test/test_as_json.rb
+++ b/test/test_as_json.rb
@@ -28,7 +28,6 @@ end
def test_as_json_options
- Oj.mimic_JSON()
raccoon = Raccoon.new('Rocket')
obj = Oj.dump(raccoon.to_json)
assert_equal(obj, '"{\"name\":\"Rocket\"}"')
|
Remove mimic call as we're now explicitly invoking the applicable methods,
|
diff --git a/lib/moonshine/no_www.rb b/lib/moonshine/no_www.rb
index abc1234..def5678 100644
--- a/lib/moonshine/no_www.rb
+++ b/lib/moonshine/no_www.rb
@@ -26,7 +26,6 @@ if configuration[:ssl]
rewrite_section = <<-MOD_REWRITE_SSL
# SSL WWW Redirect
- RewriteCond %{HTTP_HOST} !^#{domain.gsub('.', '\.')}$ [NC]
RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
RewriteRule ^(.*)$ https://%1$1 [L,R=301]
MOD_REWRITE_SSL
|
Apply change to ssl section too.
|
diff --git a/lib/mws-rb/api/feeds.rb b/lib/mws-rb/api/feeds.rb
index abc1234..def5678 100644
--- a/lib/mws-rb/api/feeds.rb
+++ b/lib/mws-rb/api/feeds.rb
@@ -18,7 +18,7 @@ params = params.except(:merchant_id, :message_type, :message, :messages, :skip_schema_validation)
call(:submit_feed, params.merge!(
request_params: {
- format: "xml",
+ format: :xml,
headers: {
"Content-MD5" => xml_envelope.md5
},
|
Fix format option used in the submit_feed method
|
diff --git a/examples/06_treeview.rb b/examples/06_treeview.rb
index abc1234..def5678 100644
--- a/examples/06_treeview.rb
+++ b/examples/06_treeview.rb
@@ -0,0 +1,49 @@+$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
+require 'gir_ffi-gtk3'
+
+Gtk.init
+
+
+#Add window.
+win = Gtk::Window.new(:toplevel)
+win.resize(640, 480)
+GObject.signal_connect(win, "destroy"){ Gtk.main_quit }
+
+
+#Add treeview.
+tv = Gtk::TreeView.new
+
+
+#Add store.
+ls = Gtk::ListStore.new([GObject::TYPE_STRING])
+tv.set_model(ls)
+
+
+#Add column.
+lab = Gtk::Label.new("Name")
+rend = Gtk::CellRendererText.new
+
+col = Gtk::TreeViewColumn.new
+col.set_widget(lab)
+col.pack_start(rend, true)
+col.add_attribute(rend, "text", 0)
+
+lab.show
+
+tv.append_column(col)
+
+
+#Add rows.
+iter = ls.append
+ls.set_value(iter, 0, "Kasper")
+
+iter = ls.append
+ls.set_value(iter, 0, "Christina")
+
+
+win.add tv
+tv.show
+
+win.show
+
+Gtk.main
|
Add tree view example [merges 'kaspernj/master']
|
diff --git a/commands/development_playground_command.rb b/commands/development_playground_command.rb
index abc1234..def5678 100644
--- a/commands/development_playground_command.rb
+++ b/commands/development_playground_command.rb
@@ -0,0 +1,40 @@+module ChatBotCommand
+ class DevPlaygroundCommand
+ TITLE = "DevPlaygroundCommand"
+ REGEX = /\b(NKB[0-9]+)/i # look for 'KB' followed by numbers, e.g. KB012983
+ COMMAND = "Offers links to ServiceNow when knowledge base numbers are mentioned, e.g. KB12345"
+ DESCRIPTION = "Offers a link to the ServiceNow knowledge base when KB articles are mentioned"
+
+ def run(message, channel, private_allowed)
+ unless $SETTINGS["SERVICENOW_KB_URL"]
+ $logger.error "Cannot run DevPlaygroundCommand command: ensure SERVICENOW_KB_URL is in settings."
+ return "DevPlaygroundCommand support not correctly configured."
+ end
+
+ messages = []
+ matches = nil
+
+ case message
+ # look for characters at the beginning of the line or following a space
+ # followed by / followed by numbers, e.g. dw/123
+ when /(KB[0-9]+)/i then
+ matches = message.scan(/(KB[0-9]+)/i)
+ end
+
+ return [] unless matches
+
+ matches.each do |m|
+ messages.push "#{$SETTINGS["SERVICENOW_KB_URL"]}" + m[0]
+ end
+
+ return messages.join("\n")
+ end
+
+ @@instance = DevPlaygroundCommand.new
+ def self.get_instance
+ return @@instance
+ end
+
+ private_class_method :new
+ end
+end
|
Add development playground command for testing purposes
|
diff --git a/app/controllers/credit_scores_controller.rb b/app/controllers/credit_scores_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/credit_scores_controller.rb
+++ b/app/controllers/credit_scores_controller.rb
@@ -15,4 +15,8 @@ def obj_params
params.require(:credit_score).permit(:score_date, :score, :source)
end
+
+ def new_obj_initialize
+ @obj.score_date = Date.today
+ end
end
|
Set default new credit score date
|
diff --git a/lib/tasks/database.rake b/lib/tasks/database.rake
index abc1234..def5678 100644
--- a/lib/tasks/database.rake
+++ b/lib/tasks/database.rake
@@ -0,0 +1,24 @@+namespace :db do
+ desc "Create a lot of data in the database to test syncing performance"
+ task muchdata: :environment do
+ 10.times do |i_n|
+ i = Instrument.create!(title: "Instrument #{i_n}",
+ language: Settings.languages.sample,
+ alignment: "left"
+ )
+ p "Created #{i.title}"
+ 1000.times do |q_n|
+ question_type = Settings.question_types.sample
+ question = i.questions.create!(text: "Question #{q_n}",
+ question_identifier: "#{i_n}_q_#{q_n}",
+ question_type: Settings.question_types.sample
+ )
+ if Settings.question_with_options.include? question_type
+ 5.times do |o_n|
+ question.options.create!(text: "Option #{o_n}")
+ end
+ end
+ end
+ end
+ end
+end
|
Add rake task for inserting a lot of data to db
|
diff --git a/lib/xbox_leaders/api.rb b/lib/xbox_leaders/api.rb
index abc1234..def5678 100644
--- a/lib/xbox_leaders/api.rb
+++ b/lib/xbox_leaders/api.rb
@@ -12,7 +12,7 @@ end
def fetch_achievements(gamertag, game_id)
- get('/achievements', gamertag: gamertag, titleid: game_id)
+ get('/achievements', gamertag: gamertag, gameid: game_id)
end
def fetch_friends(gamertag)
|
Fix achievements endpoint for new gameid param.
|
diff --git a/config/initializers/omniauth_shibboleth.rb b/config/initializers/omniauth_shibboleth.rb
index abc1234..def5678 100644
--- a/config/initializers/omniauth_shibboleth.rb
+++ b/config/initializers/omniauth_shibboleth.rb
@@ -1,5 +1,5 @@ Rails.application.config.middleware.use OmniAuth::Builder do
- if Rails.env.production?
+ if true #Rails.env.production?
opts = YAML.load_file(File.join(Rails.root, 'config', 'shibboleth.yml'))[Rails.env]
provider :shibboleth, opts.symbolize_keys
Dmptool2::Application.shibboleth_host = opts['host']
|
Fix up for testing - had wrong dns name.
|
diff --git a/config/initializers/metal_archives.rb b/config/initializers/metal_archives.rb
index abc1234..def5678 100644
--- a/config/initializers/metal_archives.rb
+++ b/config/initializers/metal_archives.rb
@@ -1,4 +1,7 @@ # frozen_string_literal: true
+
+require Rails.root.join("lib/headbanger/app.rb")
+require Rails.root.join("lib/headbanger/version.rb")
MetalArchives.configure do |c|
## Application identity (required)
|
Load Headbanger version to avoid autoload errors
|
diff --git a/core/spec/entities/menu/menu_entry_spec.rb b/core/spec/entities/menu/menu_entry_spec.rb
index abc1234..def5678 100644
--- a/core/spec/entities/menu/menu_entry_spec.rb
+++ b/core/spec/entities/menu/menu_entry_spec.rb
@@ -5,7 +5,7 @@ describe MenuEntry do
it "wraps passed children" do
e = MenuEntry.new('My title', [{:title => 'Child 1'}])
- e.children.first.class.should == MenuEntry
+ expect(e.children.first).to be_kind_of Abc::MenuEntry
end
end
end
|
Use be_kind_of in class comparison.
|
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
@@ -1,2 +1,8 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), *%w[.. .. lib]))
+Before do
+ if test_proxy = ENV["MIMIC_TEST_PROXY"]
+ puts "(Using proxy #{test_proxy})"
+ HttpClient.use_proxy(test_proxy)
+ end
+end
|
Support use of an HTTP proxy when running Cucumber features to assist debugging.
|
diff --git a/week-4/simple-string.rb b/week-4/simple-string.rb
index abc1234..def5678 100644
--- a/week-4/simple-string.rb
+++ b/week-4/simple-string.rb
@@ -0,0 +1,31 @@+# Solution Below
+
+
+
+
+
+# RSpec Tests. They are included in this file because the local variables you are creating are not accessible across files. If we try to run these files as a separate file per normal operation, the local variable checks will return nil.
+
+old_string = "Ruby is cool"
+new_string = old_string.reverse.upcase
+
+
+describe "old_string" do
+ it 'is defined as a local variable' do
+ expect(defined?(old_string)).to eq 'local-variable'
+ end
+
+ it "has the value 'Ruby is cool'" do
+ expect(old_string).to eq "Ruby is cool"
+ end
+end
+
+describe 'new_string' do
+ it 'is defined as a local variable' do
+ expect(defined?(new_string)).to eq 'local-variable'
+ end
+
+ it 'has the value "LOOC SI YBUR"' do
+ expect(new_string).to eq "LOOC SI YBUR"
+ end
+end
|
Add file for simple string
|
diff --git a/benchmarks/acceptable.rb b/benchmarks/acceptable.rb
index abc1234..def5678 100644
--- a/benchmarks/acceptable.rb
+++ b/benchmarks/acceptable.rb
@@ -0,0 +1,28 @@+require 'rubygems'
+require 'rbench'
+require File.expand_path('../../lib/rack/acceptable', __FILE__)
+
+TIMES = 10_000
+
+SIMPLE = "text/html"
+SAFARI = "application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"
+
+ONE = "text/html"
+THREE = "text/html,application/xml,application/xhtml+xml"
+
+RBench.run(TIMES) do
+
+ column :one, :title => "One choice"
+ column :three, :title => "Three choices"
+
+ report "Simple #{SIMPLE}" do
+ one { Rack::Request::AcceptableMediaTypes.new(SIMPLE).first_acceptable(ONE) }
+ three { Rack::Request::AcceptableMediaTypes.new(SIMPLE).first_acceptable(THREE) }
+ end
+
+ report "Safari" do
+ one { Rack::Request::AcceptableMediaTypes.new(SAFARI).first_acceptable(ONE) }
+ three { Rack::Request::AcceptableMediaTypes.new(SAFARI).first_acceptable(THREE) }
+ end
+
+end
|
Add a benchmark at yehuda's request
|
diff --git a/rake_tasks/jeweler.rake b/rake_tasks/jeweler.rake
index abc1234..def5678 100644
--- a/rake_tasks/jeweler.rake
+++ b/rake_tasks/jeweler.rake
@@ -6,7 +6,7 @@
def extract_description_from_readme
readme = File.open(README_PATH, 'r', &:read)
- s = readme[/^# FTPD\n+((?:.*\n)+?)\n*##/i, 1]
+ s = readme[/^# FTPD.*\n+((?:.*\n)+?)\n*##/i, 1]
s.gsub(/\n/, ' ').strip
end
|
Fix rake tasks, busted by b9e5a88 (Add code climate tag to README)
|
diff --git a/test/integration/openstackrc/serverspec/default_spec.rb b/test/integration/openstackrc/serverspec/default_spec.rb
index abc1234..def5678 100644
--- a/test/integration/openstackrc/serverspec/default_spec.rb
+++ b/test/integration/openstackrc/serverspec/default_spec.rb
@@ -1,12 +1,7 @@ require 'serverspec'
describe 'openstackrc' do
- case os[:family]
- when 'centos', 'redHat', 'fedora'
- RSpec.configure do |c|
- c.path = '/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin'
- end
- end
+ set :path, '/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:$PATH'
describe file('/usr/local/bin/openstack') do
it { should be_executable }
|
Fix PATH in tests for new serverspec
|
diff --git a/core/main/private_spec.rb b/core/main/private_spec.rb
index abc1234..def5678 100644
--- a/core/main/private_spec.rb
+++ b/core/main/private_spec.rb
@@ -14,4 +14,12 @@ it "returns Object" do
eval("private :main_public_method", TOPLEVEL_BINDING).should equal(Object)
end
+
+ it "raises a NameError when given an undefined name" do
+ lambda {eval "private :main_undefined_method", TOPLEVEL_BINDING}.should(
+ raise_error(NameError) do |err|
+ err.should be_an_instance_of(NameError)
+ end
+ )
+ end
end
|
Add a spec for main.private when given an undefined name
|
diff --git a/app/lib/finder_schema.rb b/app/lib/finder_schema.rb
index abc1234..def5678 100644
--- a/app/lib/finder_schema.rb
+++ b/app/lib/finder_schema.rb
@@ -13,6 +13,20 @@
def options_for(facet_name)
allowed_values_as_option_tuples(allowed_values_for(facet_name))
+ end
+
+ def humanized_facet_name(key, &block)
+ facet_data_for(key).fetch("name", &block)
+ end
+
+ def humanized_facet_value(facet_key, value, &block)
+ if facet_data_for(facet_key).fetch("type", nil) == "multi-select"
+ value.map do |v|
+ value_label_mapping_for(facet_key, v).fetch("label", &block)
+ end
+ else
+ value_label_mapping_for(facet_key, value).fetch("label", &block)
+ end
end
private
@@ -38,4 +52,10 @@ ]
end
end
+
+ def value_label_mapping_for(facet_key, value)
+ allowed_values_for(facet_key).find do |av|
+ av.fetch("value") == value.to_s
+ end || {}
+ end
end
|
Allow FinderSchema to humanize values
|
diff --git a/app/workers/dependency_resolution_worker.rb b/app/workers/dependency_resolution_worker.rb
index abc1234..def5678 100644
--- a/app/workers/dependency_resolution_worker.rb
+++ b/app/workers/dependency_resolution_worker.rb
@@ -28,7 +28,7 @@ end
def present_content_store(dependent_content_id)
- latest_content_item ||= Queries::GetLatest.call(
+ latest_content_item = Queries::GetLatest.call(
ContentItem.where(content_id: dependent_content_id)
).last
|
Remove unnecessary or equals operator
|
diff --git a/Casks/android-studio-bundle.rb b/Casks/android-studio-bundle.rb
index abc1234..def5678 100644
--- a/Casks/android-studio-bundle.rb
+++ b/Casks/android-studio-bundle.rb
@@ -1,7 +1,7 @@ class AndroidStudioBundle < Cask
- url 'https://dl.google.com/android/studio/install/0.4.2/android-studio-bundle-133.970939-mac.dmg'
+ url 'https://dl.google.com/android/studio/install/0.5.2/android-studio-bundle-135.1078000-mac.dmg'
homepage 'http://developer.android.com/sdk/installing/studio.html'
- version '0.4.2 build-133.970939'
- sha256 '28226e2ae7186a12bc196abe28ccc611505e3f6aa84da6afc283d83bb7995a8b'
+ version '0.5.2 build-135.1078000'
+ sha256 'fbb0500af402c8fa5435dfac65e16101a70a22c4c8930f072db52ac41556fb8e'
link 'Android Studio.app'
end
|
Upgrade Android Studio Bundle to v0.5.2
|
diff --git a/client/ruby/solrb/test/unit/solr_mock_base.rb b/client/ruby/solrb/test/unit/solr_mock_base.rb
index abc1234..def5678 100644
--- a/client/ruby/solrb/test/unit/solr_mock_base.rb
+++ b/client/ruby/solrb/test/unit/solr_mock_base.rb
@@ -13,6 +13,7 @@ require 'test/unit'
require 'solr'
+# TODO: Maybe replace this with flexmock
class SolrMockBaseTestCase < Test::Unit::TestCase
include Solr
|
Add TODO note about perhaps replacing our mock with the use of flexmock. Not worth adding this dependency just yet, only when we feel pain in mocking later
git-svn-id: 3b1ff1236863b4d63a22e4dae568675c2e247730@500588 13f79535-47bb-0310-9956-ffa450edef68
|
diff --git a/db/migrate/20170405123353_add_a_dummy_user.rb b/db/migrate/20170405123353_add_a_dummy_user.rb
index abc1234..def5678 100644
--- a/db/migrate/20170405123353_add_a_dummy_user.rb
+++ b/db/migrate/20170405123353_add_a_dummy_user.rb
@@ -0,0 +1,16 @@+class AddADummyUser < ActiveRecord::Migration[5.0]
+ USER_INFO = {
+ name: 'Princess Rachael',
+ email: 'princess@mail.com',
+ password: '12345678'
+ }
+
+ def up
+ User.create! USER_INFO
+ end
+
+ def down
+ user = User.find_by_email(USER_INFO[:email])
+ user.destroy!
+ end
+end
|
Add dummy user to test CircleCI/Heroku continuous deployment
|
diff --git a/files/default/tests/minitest/hbase_test.rb b/files/default/tests/minitest/hbase_test.rb
index abc1234..def5678 100644
--- a/files/default/tests/minitest/hbase_test.rb
+++ b/files/default/tests/minitest/hbase_test.rb
@@ -5,5 +5,35 @@ include Helpers::Hadoop
# Example spec tests can be found at http://git.io/Fahwsw
+ it 'creates hbase conf dir' do
+ directory("/etc/hbase/#{node['hbase']['conf_dir']}")
+ .must_exist
+ .with(:owner, 'root')
+ .and(:group, 'root')
+ .and(:mode, '0755')
+ end
+
+ it 'ensures alternatives link' do
+ link('/etc/hbase/conf')
+ .must_exist
+ .with(:link_type, :symbolic)
+ .and(:to, '/etc/alternatives/hbase-conf')
+ link('/etc/alternatives/hbase-conf')
+ .must_exist
+ .with(:link_type, :symbolic)
+ .and(:to, "/etc/hbase/#{node['hbase']['conf_dir']}")
+ end
+
+ it 'creates hbase config files' do
+ %w(hbase_policy hbase_site).each do |sitefile|
+ if node['hbase'].key? sitefile
+ file("/etc/hbase/#{node['hbase']['conf_dir']}/#{sitefile.gsub('_', '-')}.xml")
+ .must_exist
+ .with(:owner, 'root')
+ .and(:group, 'root')
+ .and(:mode, '0644')
+ end
+ end
+ end
end
|
Add tests for hbase recipe
|
diff --git a/lib/rom/plugins/relation/sql/auto_combine.rb b/lib/rom/plugins/relation/sql/auto_combine.rb
index abc1234..def5678 100644
--- a/lib/rom/plugins/relation/sql/auto_combine.rb
+++ b/lib/rom/plugins/relation/sql/auto_combine.rb
@@ -42,8 +42,7 @@
# @api private
def preload(source_key, target_key, source)
- source_attr = source_key.is_a?(ROM::SQL::QualifiedName) ? source_key.attribute : source_key
- where(target_key => source.map { |tuple| tuple[source_attr] })
+ where(target_key => source.map { |tuple| tuple[source_key.to_sym] })
end
end
end
|
Use .to_sym interface for keys
|
diff --git a/lib/sinatra-websocket/ext/sinatra/request.rb b/lib/sinatra-websocket/ext/sinatra/request.rb
index abc1234..def5678 100644
--- a/lib/sinatra-websocket/ext/sinatra/request.rb
+++ b/lib/sinatra-websocket/ext/sinatra/request.rb
@@ -5,7 +5,8 @@
# Taken from skinny https://github.com/sj26/skinny and updated to support Firefox
def websocket?
- env['HTTP_CONNECTION'].split(',').map(&:strip).map(&:downcase).include?('upgrade') &&
+ env['HTTP_CONNECTION'] && env['HTTP_UPGRADE'] &&
+ env['HTTP_CONNECTION'].split(',').map(&:strip).map(&:downcase).include?('upgrade') &&
env['HTTP_UPGRADE'].downcase == 'websocket'
end
|
Check if headers exist instead of crashing
This should solve problems with Rack::Test, which does not pass the Connection header.
|
diff --git a/spec/decorators/category_navigation_decorator_spec.rb b/spec/decorators/category_navigation_decorator_spec.rb
index abc1234..def5678 100644
--- a/spec/decorators/category_navigation_decorator_spec.rb
+++ b/spec/decorators/category_navigation_decorator_spec.rb
@@ -15,7 +15,7 @@ describe '#path' do
let(:id) { 'expected-id' }
let(:category) { build(:category, id: id) }
- let(:item) { double(id: double, content: category) }
+ let(:item) { double(id: id, content: category) }
it 'calls to the correct path helper' do
expect(main_app_helper).to receive(:category_path).with(id)
|
Fix typo / strange presence of `double`.
|
diff --git a/app/models/email_processor.rb b/app/models/email_processor.rb
index abc1234..def5678 100644
--- a/app/models/email_processor.rb
+++ b/app/models/email_processor.rb
@@ -4,8 +4,12 @@ end
def process
+ to = @email.to[0][:email]
+ if @email.headers && !@email.headers["X-Forwarded-To"].nil?
+ to = @email.headers["X-Forwarded-To"]
+ end
Email.create(
- to: @email.headers["X-Forwarded-To"],
+ to: to,
from: @email.from[:email],
subject: @email.subject,
raw_text: @email.raw_text,
|
Save the way to run the goodies
|
diff --git a/lib/sync_checker/formats/detailed_guide_check.rb b/lib/sync_checker/formats/detailed_guide_check.rb
index abc1234..def5678 100644
--- a/lib/sync_checker/formats/detailed_guide_check.rb
+++ b/lib/sync_checker/formats/detailed_guide_check.rb
@@ -42,6 +42,10 @@ def related_mainstream_content_ids(edition)
edition.related_mainstreams.pluck(:content_id)
end
+
+ def rendering_app
+ Whitehall::RenderingApp::GOVERNMENT_FRONTEND
+ end
end
end
end
|
Update Detailed Guide sync check rendering app
Now checks that it is 'government-frontend'
|
diff --git a/lib/buildr_plus/features/source_code_analysis.rb b/lib/buildr_plus/features/source_code_analysis.rb
index abc1234..def5678 100644
--- a/lib/buildr_plus/features/source_code_analysis.rb
+++ b/lib/buildr_plus/features/source_code_analysis.rb
@@ -13,6 +13,28 @@ #
module BuildrPlus
+ class SourceCodeAnalysisConfig
+ class << self
+ attr_writer :findbugs_enabled
+
+ def findbugs_enabled?
+ @findbugs_enabled.nil? ? true : !!@findbugs_enabled
+ end
+
+ attr_writer :pmd_enabled
+
+ def pmd_enabled?
+ @pmd_enabled.nil? ? true : !!@pmd_enabled
+ end
+
+ attr_writer :jdepend_enabled
+
+ def jdepend_enabled?
+ @jdepend_enabled.nil? ? true : !!@jdepend_enabled
+ end
+ end
+ end
+
module SourceCodeAnalysisExtension
module ProjectExtension
include Extension
@@ -20,9 +42,9 @@
before_define do |project|
if project.ipr?
- project.jdepend.enabled = true
- project.findbugs.enabled = true
- project.pmd.enabled = true
+ project.jdepend.enabled = true if BuildrPlus::SourceCodeAnalysisConfig.jdepend_enabled?
+ project.findbugs.enabled = true if BuildrPlus::SourceCodeAnalysisConfig.findbugs_enabled?
+ project.pmd.enabled = true if BuildrPlus::SourceCodeAnalysisConfig.pmd_enabled?
end
end
end
|
Make it possible to disable various source code analysis phases
|
diff --git a/auto_book.rb b/auto_book.rb
index abc1234..def5678 100644
--- a/auto_book.rb
+++ b/auto_book.rb
@@ -13,5 +13,5 @@ latest_date: DateTime.parse(ENV.fetch('TEST_LATEST_DATE'))
}
-puts '[*] Running'
+puts "[*] Run started at #{DateTime.now}"
driver.run options
|
Print run time at start of run
|
diff --git a/spec/factories/drawings.rb b/spec/factories/drawings.rb
index abc1234..def5678 100644
--- a/spec/factories/drawings.rb
+++ b/spec/factories/drawings.rb
@@ -4,7 +4,7 @@ description "Description of the content of this drawing"
gender "other"
age 10
- mood_rating 7
+ mood_rating 4
subject_matter "Camp life"
story "Context of the drawing, e.g. child's back story, cultural notes"
country "GR"
|
Update drawing factory to make sure the mood_rating is between 1-5;
|
diff --git a/spec/models/author_spec.rb b/spec/models/author_spec.rb
index abc1234..def5678 100644
--- a/spec/models/author_spec.rb
+++ b/spec/models/author_spec.rb
@@ -5,7 +5,6 @@ should_allow_values_for :name, "John Doe", :allow_nil => true
should_validate_length_of :name, :minimum => 2, :maximum => 255
should_allow_values_for :email, "john@doe.co.uk", :allow_nil => true
- should_not_allow_values_for :email, "test", "test@test", "test@"
should_have_many :versions
it "should have unique values for email scoped on name" do
|
Update spec to reflect changes in Author model
|
diff --git a/spec/subtime/timer_spec.rb b/spec/subtime/timer_spec.rb
index abc1234..def5678 100644
--- a/spec/subtime/timer_spec.rb
+++ b/spec/subtime/timer_spec.rb
@@ -22,9 +22,10 @@ end
end
- context "for 10 minutes with messages" do
+ context "for 10 minutes with code blocks" do
let(:minutes) { 10 }
- let(:messages) { { 5 => "something", 2 => "something else" } }
+ let(:messages) { { 5 => lambda { puts "Something" },
+ 2 => lambda { puts "something else" } } }
let(:timer) { Timer.new(output, minutes, messages) }
it "outputs 'Starting timer for 10 minutes...'" do
@@ -40,6 +41,13 @@
timer.start
end
+
+ it "calls the specified code blocks" do
+ expect(output).to receive(:puts).with("Something")
+ expect(output).to receive(:puts).with("something else")
+
+ timer.start
+ end
end
end
end
|
Test for calling a code block
|
diff --git a/spec/support/dummy_view.rb b/spec/support/dummy_view.rb
index abc1234..def5678 100644
--- a/spec/support/dummy_view.rb
+++ b/spec/support/dummy_view.rb
@@ -1,4 +1,4 @@-require 'action_view'
+require "action_view"
class DummyView < ActionView::Base
module FakeRequest
@@ -20,9 +20,11 @@ include ActionView::Helpers::UrlHelper
include Loaf::ViewExtensions
- def initialize(*args)
+ def initialize
context = ActionView::LookupContext.new([])
- super(context, *args)
+ assigns = {}
+ controller = nil
+ super(context, assigns, controller)
end
attr_reader :_breadcrumbs
@@ -46,7 +48,7 @@ def set_path(path)
request.path = path
request.fullpath = path
- request.protocol = 'http://'
- request.host_with_port = 'www.example.com'
+ request.protocol = "http://"
+ request.host_with_port = "www.example.com"
end
end
|
Update DummyView to pass in required arguments as required by Rails 6.1
|
diff --git a/app/models/report.rb b/app/models/report.rb
index abc1234..def5678 100644
--- a/app/models/report.rb
+++ b/app/models/report.rb
@@ -21,7 +21,8 @@
validates :summary, length: { maximum: 40 }
- validates :reuniter_name, :reuniter_email,
- presence: true, if: proc {|r| r.reunited? }
-
+ validates :reuniter_name, :reuniter_email, presence: true,
+ unless: proc {|r|
+ (r.changed & %w{reunited reuniter_email reuniter_name}).empty?
+ }
end
|
Allow editing reunion_confirmation fields when reuniter info is missing
|
diff --git a/scripts/lint-groups.rb b/scripts/lint-groups.rb
index abc1234..def5678 100644
--- a/scripts/lint-groups.rb
+++ b/scripts/lint-groups.rb
@@ -12,7 +12,22 @@ data.each_value do |group|
group.each do |category|
category['files'].each do |file|
- files_in_groups << File.basename(file['path'])
+ basename = File.basename(file['path'])
+ if files_in_groups.include?(basename)
+ puts ''
+ puts '----------------------------------------'
+ puts 'ERROR:'
+ puts 'There are some duplicated entries in public/groups.json.'
+ puts 'Please remove them from public/groups.json.'
+ puts '----------------------------------------'
+ puts ''
+ puts "- #{basename}"
+ puts ''
+
+ exit 1
+ end
+
+ files_in_groups << basename
end
end
end
|
Check duplicated entry in public/groups.json
|
diff --git a/scripts/list-routes.rb b/scripts/list-routes.rb
index abc1234..def5678 100644
--- a/scripts/list-routes.rb
+++ b/scripts/list-routes.rb
@@ -5,9 +5,7 @@
routes_by_domain_url = {}
-page = JSON.parse `cf curl '/v2/routes?results-per-page=100'`
-next_url = page["next_url"]
-
+next_url = '/v2/routes?results-per-page=100'
while next_url
page = JSON.parse `cf curl '#{next_url}'`
page['resources'].map do |resource|
|
Fix bug where the first page of results is skipped
`page` was set to the next_url page before we looked at any of the
resources on the first page.
|
diff --git a/scripts/npm_bundles.rb b/scripts/npm_bundles.rb
index abc1234..def5678 100644
--- a/scripts/npm_bundles.rb
+++ b/scripts/npm_bundles.rb
@@ -4,22 +4,24 @@ npms = {
# module name => module command
# leave command blank if they are the same
+ "bower" => "",
+ "casperjs" => "",
"coffee-script" => "coffee",
+ "dalek-cli" => "dalek",
+ "express" => "",
+ "gh" => "",
"grunt-cli" => "grunt",
- "dalek-cli" => "dalek",
+ "gulp" => "",
+ "html2jade" => "",
+ "hubot" => "",
+ "jshint" => "",
+ "keybase" => "",
+ "mocha" => "",
+ "nodemon" => "",
"phantomjs" => "",
- "capserjs" => "",
- "gulp" => "",
- "gh" => "",
- "bower" => "",
+ "protractor" => "",
+ "sails" => "",
"yo" => "",
- "jshint" => "",
- "express" => "",
- "nodemon" => "",
- "mocha" => "",
- "sails" => "",
- "phantomjs" => "",
- "casperjs" => ""
}
npms.each do |mod, command|
|
Refactor NPM modules install script
|
diff --git a/lib/rbNFA.rb b/lib/rbNFA.rb
index abc1234..def5678 100644
--- a/lib/rbNFA.rb
+++ b/lib/rbNFA.rb
@@ -6,4 +6,10 @@
end
end
+
+ class Lexer
+ def lex(regexp)
+ return []
+ end
+ end
end
|
Add basic implementation for first test in regexp.
|
diff --git a/recipes/default.rb b/recipes/default.rb
index abc1234..def5678 100644
--- a/recipes/default.rb
+++ b/recipes/default.rb
@@ -17,13 +17,6 @@ # limitations under the License.
#
-case node["platform"]
-when "debian", "ubuntu"
- package 'ruby1.9.1-dev'
-when "redhat", "centos", "fedora"
-
-end
-
mysql_chef_gem 'default' do
action :install
end
|
Revert "Added dependacy for mysql-chef-gem"
This reverts commit 84f2f2fad79a882bcf6d97d69caf0f78099f52ed.
|
diff --git a/recipes/default.rb b/recipes/default.rb
index abc1234..def5678 100644
--- a/recipes/default.rb
+++ b/recipes/default.rb
@@ -5,8 +5,9 @@ # Copyright (C) 2015 Sunggun Yu <sunggun.dev@gmail.com>
# Copyright (C) 2015 Bloomberg Finance L.P.
#
+
node.default['rabbitmq']['cluster'] = true
-include_recipe 'rabbitmq::default'
+include_recipe 'rabbitmq::plugin_management'
rabbitmq_service = service node['rabbitmq']['service_name'] do
supports restart: true, status: true
|
Use the plugin management cookbook to install any plugins.
|
diff --git a/test/spec/libraries/consul_installation_webui_spec.rb b/test/spec/libraries/consul_installation_webui_spec.rb
index abc1234..def5678 100644
--- a/test/spec/libraries/consul_installation_webui_spec.rb
+++ b/test/spec/libraries/consul_installation_webui_spec.rb
@@ -15,7 +15,6 @@ end
it do
- pending('replace with poise-archive')
is_expected.to create_directory('/opt/consul-webui/0.7.1')
.with(
recursive: true
@@ -23,7 +22,6 @@ end
it do
- pending('replace with poise-archive')
is_expected.to create_directory('/var/lib/consul')
.with(
recursive: true
@@ -31,10 +29,9 @@ end
it do
- pending('replace with poise-archive')
- is_expected.to unzip_zipfile('consul_0.7.1_web_ui.zip')
- .with(
- source: 'https://releases.hashicorp.com/consul/0.7.1/consul_0.7.1_web_ui.zip'
+ is_expected.to unpack_poise_archive('https://releases.hashicorp.com/consul/0.7.1/consul_0.7.1_web_ui.zip').with(
+ destination: '/opt/consul-webui/0.7.1',
+ merged_source_properties: {'checksum' => '1b793c60e1af24cc470421d0411e13748f451b51d8a6ed5fcabc8d00bfb84264' }
)
end
end
|
Move spec tests to use poise-archive matchers
|
diff --git a/test/unit/govuk_index/elasticsearch_processor_test.rb b/test/unit/govuk_index/elasticsearch_processor_test.rb
index abc1234..def5678 100644
--- a/test/unit/govuk_index/elasticsearch_processor_test.rb
+++ b/test/unit/govuk_index/elasticsearch_processor_test.rb
@@ -4,7 +4,7 @@ def test_should_save_valid_document
presenter = stub(:presenter)
presenter.stubs(:identifier).returns(
- _type: "cheddar",
+ _type: "help_page",
_id: "/cheese"
)
presenter.stubs(:document).returns(
@@ -20,4 +20,31 @@ actions.save(presenter)
actions.commit
end
+
+ def test_should_delete_valid_document
+ presenter = stub(:presenter)
+ presenter.stubs(:identifier).returns(
+ _type: "help_page",
+ _id: "/cheese"
+ )
+ presenter.stubs(:document).returns(
+ link: "/cheese",
+ title: "We love cheese"
+ )
+
+ client = stub('client')
+ Services.stubs('elasticsearch').returns(client)
+ client.expects(:bulk).with(
+ index: SearchConfig.instance.govuk_index_name,
+ body: [
+ {
+ delete: presenter.identifier
+ }
+ ]
+ )
+
+ actions = GovukIndex::ElasticsearchProcessor.new
+ actions.delete(presenter)
+ actions.commit
+ end
end
|
Add unit test for deletion of valid document
This was previous part of https://github.com/alphagov/rummager/pull/864 which is closed.
However it is still a useful test.
|
diff --git a/lib/active_exchanger.rb b/lib/active_exchanger.rb
index abc1234..def5678 100644
--- a/lib/active_exchanger.rb
+++ b/lib/active_exchanger.rb
@@ -19,5 +19,5 @@ require 'active_exchanger/supervisor'
Dir.glob(Rails.root.join('app', 'exchangers', '**', '*.rb')).each do |path|
- require path
+ require_dependency path
end
|
Use require_dependency instead of require in ActiveExchanger so we don't re-require all exchangers again.
|
diff --git a/app/controllers/georgia/concerns/revisioning.rb b/app/controllers/georgia/concerns/revisioning.rb
index abc1234..def5678 100644
--- a/app/controllers/georgia/concerns/revisioning.rb
+++ b/app/controllers/georgia/concerns/revisioning.rb
@@ -18,7 +18,7 @@ @revision.approve
message = "#{current_user.name} has successfully approved and published #{@revision.title} #{instance_name}."
notify(message)
- redirect_to [:show, @page], notice: message
+ redirect_to @page, notice: message
end
def decline
@@ -32,13 +32,13 @@ @revision.revert
message = "#{current_user.name} has successfully published #{@revision.title} #{instance_name}."
notify(message)
- redirect_to [:show, @page], notice: message
+ redirect_to @page, notice: message
end
private
def notify(message)
- Notifier.notify_editors(message, url_for(action: :edit, controller: controller_name, id: @page.id)).deliver
+ Notifier.notify_editors(message, url_for([:edit, @page, @revision])).deliver
end
end
|
Fix :show urls and notify url
|
diff --git a/app/controllers/spree/admin/zones_controller.rb b/app/controllers/spree/admin/zones_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/spree/admin/zones_controller.rb
+++ b/app/controllers/spree/admin/zones_controller.rb
@@ -24,8 +24,13 @@
def permitted_resource_params
params.require(:zone).permit(
- :name, :description, :default_tax
+ :name, :description, :default_tax, :kind,
+ zone_members_attributes: [:id, :zoneable_id, :zoneable_type, :_destroy]
)
+ end
+
+ def location_after_save
+ edit_object_url(@zone)
end
end
end
|
Add missing permitted attributes to zones
|
diff --git a/app/helpers/mongoid_forums/formatting_helper.rb b/app/helpers/mongoid_forums/formatting_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/mongoid_forums/formatting_helper.rb
+++ b/app/helpers/mongoid_forums/formatting_helper.rb
@@ -10,7 +10,7 @@ end
def as_quoted_text(text)
- if MongoidForums.formatter && Forem.formatter.respond_to?(:blockquote)
+ if MongoidForums.formatter && MongoidForums.formatter.respond_to?(:blockquote)
MongoidForums.formatter.blockquote(as_sanitized_text(text)).html_safe
else
"<blockquote>#{(h(text))}</blockquote>\n\n".html_safe
@@ -21,7 +21,7 @@ if MongoidForums.formatter.respond_to?(:sanitize)
MongoidForums.formatter.sanitize(text)
else
- Forem::Sanitizer.sanitize(text)
+ MongoidForums::Sanitizer.sanitize(text)
end
end
end
|
Remove accidental reminant of Forem
|
diff --git a/buffered-logger.gemspec b/buffered-logger.gemspec
index abc1234..def5678 100644
--- a/buffered-logger.gemspec
+++ b/buffered-logger.gemspec
@@ -15,7 +15,6 @@
gem.required_ruby_version = ">= 1.9.2"
- gem.add_development_dependency "bundler", "~> 1.1"
gem.add_development_dependency "mocha", "~> 0.12.1"
gem.add_development_dependency "rake", "~> 0.9.2.2"
end
|
Remove bundler as a development dependency
|
diff --git a/app/serializers/councillor_detail_serializer.rb b/app/serializers/councillor_detail_serializer.rb
index abc1234..def5678 100644
--- a/app/serializers/councillor_detail_serializer.rb
+++ b/app/serializers/councillor_detail_serializer.rb
@@ -4,5 +4,6 @@
has_one :ward
has_many :motions
+ has_many :councillor_vote
has_many :items, as: :origin
end
|
Add a Councillor's Vote In Their Details Page
|
diff --git a/lib/ember-dev/config.rb b/lib/ember-dev/config.rb
index abc1234..def5678 100644
--- a/lib/ember-dev/config.rb
+++ b/lib/ember-dev/config.rb
@@ -15,6 +15,7 @@ attr_accessor :testing_additional_requires
attr_accessor :testing_needs_ember_data
attr_accessor :testing_ember
+ attr_accessor :dasherized_name
def initialize(hash)
hash.each{|k,v| send("#{k}=", v) }
@@ -24,7 +25,7 @@ end
def dasherized_name
- name.downcase.gsub(' ','-')
+ @dasherized_name ||= name.downcase.gsub(' ','-')
end
end
end
|
Allow dasherized_name to be specified.
|
diff --git a/spec/lib/gitlab/serializer/pagination_spec.rb b/spec/lib/gitlab/serializer/pagination_spec.rb
index abc1234..def5678 100644
--- a/spec/lib/gitlab/serializer/pagination_spec.rb
+++ b/spec/lib/gitlab/serializer/pagination_spec.rb
@@ -3,11 +3,14 @@ describe Gitlab::Serializer::Pagination do
let(:request) { spy('request') }
let(:response) { spy('response') }
+ let(:headers) { spy('headers') }
before do
- allow(request)
- .to receive(:query_parameters)
+ allow(request).to receive(:query_parameters)
.and_return(params)
+
+ allow(response).to receive(:headers)
+ .and_return(headers)
end
let(:pagination) { described_class.new(request, response) }
@@ -26,9 +29,9 @@ end
it 'appends relevant headers' do
- expect(response).to receive(:[]=).with('X-Total', '3')
- expect(response).to receive(:[]=).with('X-Total-Pages', '2')
- expect(response).to receive(:[]=).with('X-Per-Page', '2')
+ expect(headers).to receive(:[]=).with('X-Total', '3')
+ expect(headers).to receive(:[]=).with('X-Total-Pages', '2')
+ expect(headers).to receive(:[]=).with('X-Per-Page', '2')
subject
end
|
Make headers asserts explicit in pagination specs
|
diff --git a/lib/optioneer/option.rb b/lib/optioneer/option.rb
index abc1234..def5678 100644
--- a/lib/optioneer/option.rb
+++ b/lib/optioneer/option.rb
@@ -1,22 +1,22 @@ module Optioneer
- # This class will be instantiated for each individual option registered.
+ # an instance will be created for each individual option registered or passed.
class Option
attr_reader :name
- def initialize(name)
+ def initialize(name, options = {})
@name = name
- @data = {}
+ @data = options
end
def short=(short_form)
- @data[:short_form] = short_form
+ @data[:short] = short_form
end
def long=(long_form)
- @data[:long_form] = long_form
+ @data[:long] = long_form
end
def argument=(argument)
- @data[:argument] = argument
+ @data[:arg] = argument
end
def help=(help)
|
Rename the short, long etc methods
Signed-off-by: Grant Ramsay <4ab1b2fdb7784a8f9b55e81e3261617f44fd0585@gmail.com>
|
diff --git a/app/models/concerns/gobierto_common/acts_as_api_token.rb b/app/models/concerns/gobierto_common/acts_as_api_token.rb
index abc1234..def5678 100644
--- a/app/models/concerns/gobierto_common/acts_as_api_token.rb
+++ b/app/models/concerns/gobierto_common/acts_as_api_token.rb
@@ -11,8 +11,7 @@ belongs_to singularized_name, **opts.slice(:class_name, :foreign_key)
has_secure_token
validates singularized_name, presence: true
- validates :name, presence: true, unless: :primary?
- validates :name, uniqueness: { scope: singularized_name }
+ validates :name, uniqueness: { scope: singularized_name }, unless: :blank_name?
validates singularized_name, uniqueness: { scope: :primary }, if: :primary?
scope :primary, -> { where(primary: true) }
@@ -24,5 +23,9 @@ token
end
+ def blank_name?
+ name.blank?
+ end
+
end
end
|
Allow blank names in not primary api tokens
|
diff --git a/lib/taxjar/line_item.rb b/lib/taxjar/line_item.rb
index abc1234..def5678 100644
--- a/lib/taxjar/line_item.rb
+++ b/lib/taxjar/line_item.rb
@@ -4,6 +4,7 @@ class LineItem < Taxjar::Base
extend ModelAttribute
+ attribute :id, :integer
attribute :quantity, :integer
attribute :product_identifier, :string
attribute :description, :string
|
Add `id` attribute to LineItem
|
diff --git a/lib/teamcity/request.rb b/lib/teamcity/request.rb
index abc1234..def5678 100644
--- a/lib/teamcity/request.rb
+++ b/lib/teamcity/request.rb
@@ -2,32 +2,38 @@ # Defines HTTP request methods
module Request
# Perform an HTTP GET request
- def get(path, &block)
- request(:get, path, &block)
+ def get(path, options={}, &block)
+ request(:get, path, options, &block)
end
# Perform an HTTP POST request
- def post(path, &block)
- request(:post, path, &block)
+ def post(path, options={}, &block)
+ request(:post, path, options, &block)
end
# Perform an HTTP PUT request
- def put(path, &block)
- request(:put, path, &block)
+ def put(path, options={}, &block)
+ request(:put, path, options, &block)
end
# Perform an HTTP DELETE request
- def delete(path, &block)
- request(:delete, path, &block)
+ def delete(path, options={}, &block)
+ request(:delete, path, options, &block)
end
private
# Perform an HTTP request
- def request(method, path, &block)
+ def request(method, path, options, &block)
response = connection.send(method) do |request|
block.call(request) if block_given?
- request.url(path)
+ case method
+ when :get, :delete
+ request.url(path, options)
+ when :post, :put
+ request.path = path
+ request.body = options unless options.empty?
+ end
end
response.body
end
|
Add the options params back since I'll be using those instead of the build locator in another branch
|
diff --git a/TheSpot/spec/controllers/users_controller_spec.rb b/TheSpot/spec/controllers/users_controller_spec.rb
index abc1234..def5678 100644
--- a/TheSpot/spec/controllers/users_controller_spec.rb
+++ b/TheSpot/spec/controllers/users_controller_spec.rb
@@ -0,0 +1,22 @@+require 'spec_helper'
+require 'rails_helper'
+
+describe UsersController do
+ describe "#new" do
+ it "assigns a new user to @user"
+ it "renders the #new template"
+ end
+
+ describe "#create" do
+ context "with valid attributes" do
+ it "saves the new user to the database"
+ it "redirects to the login page"
+ end
+
+ context "with invalid attributes" do
+ it "does not save the new user to the database"
+ it "redirects to the #new page"
+ it "assigns a flash to notify user of error"
+ end
+ end
+end
|
Add outline of users_controller tests
|
diff --git a/bean_counter.gemspec b/bean_counter.gemspec
index abc1234..def5678 100644
--- a/bean_counter.gemspec
+++ b/bean_counter.gemspec
@@ -19,7 +19,7 @@ spec.require_paths = ['lib']
spec.add_dependency 'beaneater'
- spec.add_dependency 'stalk_climber', '>= 0.0.6'
+ spec.add_dependency 'stalk_climber', '>= 0.0.7'
spec.add_development_dependency 'bundler', '~> 1.3'
spec.add_development_dependency 'rake'
|
Update minimum required version of StalkClimber
|
diff --git a/app/constraints/feature_toggle_constraint.rb b/app/constraints/feature_toggle_constraint.rb
index abc1234..def5678 100644
--- a/app/constraints/feature_toggle_constraint.rb
+++ b/app/constraints/feature_toggle_constraint.rb
@@ -1,4 +1,6 @@ # frozen_string_literal: true
+
+require "open_food_network/feature_toggle"
class FeatureToggleConstraint
def initialize(feature_name)
|
Allow devs to lazy-load app with right dependency
|
diff --git a/app/controllers/projects/hooks_controller.rb b/app/controllers/projects/hooks_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/projects/hooks_controller.rb
+++ b/app/controllers/projects/hooks_controller.rb
@@ -18,7 +18,7 @@ if @hook.valid?
redirect_to project_hooks_path(@project)
else
- @hooks = @project.hooks
+ @hooks = @project.hooks.select(&:persisted?)
render :index
end
end
|
Fix url generation error on hook invalid create
|
diff --git a/Casks/vagrant-bar.rb b/Casks/vagrant-bar.rb
index abc1234..def5678 100644
--- a/Casks/vagrant-bar.rb
+++ b/Casks/vagrant-bar.rb
@@ -1,8 +1,8 @@ cask :v1 => 'vagrant-bar' do
- version '1.15'
- sha256 'dc4f77ad00e2751e7375eab0172323d9bd9110ced170dc4033036b530ed7fdeb'
+ version '1.16'
+ sha256 'f5c58690960269be9a7a2597a0aad098b4bd1676c9494f6022e9c7d1e82d81bc'
- url "https://github.com/BipSync/VagrantBar/releases/download/#{version}/Vagrant.Bar.zip"
+ url "https://github.com/BipSync/VagrantBar/releases/download/#{version.gsub('1.','')}/Vagrant.Bar.zip"
homepage 'https://github.com/BipSync/VagrantBar'
license :oss
|
Update Vagrant Bar to v1.16
|
diff --git a/engine/wikimedia_image.rb b/engine/wikimedia_image.rb
index abc1234..def5678 100644
--- a/engine/wikimedia_image.rb
+++ b/engine/wikimedia_image.rb
@@ -15,7 +15,7 @@ name = wikimedia_image_name(url)
return nil if name.nil?
api_url = wikimedia_image_api_url(name)
- result ||= ::MultiJson.load(open(api_url,
+ result ||= ::MultiJson.load(URI.open(api_url,
"User-Agent" => "discourse-musicbrainz-onebox",
:read_timeout => timeout))
pages = result["query"]["pages"]
|
Replace another instance of open with URI.open
|
diff --git a/config/deploy/staging.rb b/config/deploy/staging.rb
index abc1234..def5678 100644
--- a/config/deploy/staging.rb
+++ b/config/deploy/staging.rb
@@ -21,6 +21,8 @@ on_rollback { run "rm #{release_path}/config/database.yml" }
run "rm #{release_path}/config/database.yml"
run "ln -s #{db_config} #{release_path}/config/database.yml"
+ rm_r "#{release_path}/test"
+ run "ln -s #{release_path}/public #{release_path}/test"
end
namespace :deploy do
|
Change to deployment recipe to support nginx deploy
|
diff --git a/IBMWatsonRestKit.podspec b/IBMWatsonRestKit.podspec
index abc1234..def5678 100644
--- a/IBMWatsonRestKit.podspec
+++ b/IBMWatsonRestKit.podspec
@@ -1,7 +1,7 @@ Pod::Spec.new do |s|
s.name = 'IBMWatsonRestKit'
- s.version = '0.32.0'
+ s.version = '0.33.0'
s.summary = 'Dependency for the IBM Watson SDK'
s.description = <<-DESC
Handles the networking layer for all IBM Watson SDK frameworks.
@@ -14,7 +14,7 @@ s.module_name = 'RestKit'
s.ios.deployment_target = '8.0'
- s.source = { :git => 'https://github.com/watson-developer-cloud/swift-sdk.git', :tag => s.version.to_s }
+ s.source = { :git => 'https://github.com/watson-developer-cloud/swift-sdk.git', :tag => "v#{s.version.to_s}" }
s.source_files = 'Source/RestKit/**/*.swift'
end
|
Prepare RestKit for its first Cocoapods release
|
diff --git a/lib/knife-solo/node_config_command.rb b/lib/knife-solo/node_config_command.rb
index abc1234..def5678 100644
--- a/lib/knife-solo/node_config_command.rb
+++ b/lib/knife-solo/node_config_command.rb
@@ -25,7 +25,7 @@
def generate_node_config
if node_config.exist?
- ui.msg "Node config '#{node_config}' already exists"
+ Chef::Log.debug "Node config '#{node_config}' already exists"
else
ui.msg "Generating node config '#{node_config}'..."
File.open(node_config, 'w') do |f|
|
Use debug message when node config already exists
|
diff --git a/lib/paperclip/dropbox/tasks/authorize.rake b/lib/paperclip/dropbox/tasks/authorize.rake
index abc1234..def5678 100644
--- a/lib/paperclip/dropbox/tasks/authorize.rake
+++ b/lib/paperclip/dropbox/tasks/authorize.rake
@@ -4,6 +4,9 @@ namespace :dropbox do
desc "Obtains your Dropbox credentials"
task :authorize do
+ if ENV["APP_KEY"].nil? or ENV["APP_SECRET"].nil?
+ raise ArgumentError, "usage: `rake dropbox:authorize APP_KEY=your_app_key APP_SECRET=your_app_secret`"
+ end
Paperclip::Dropbox::Rake.authorize(ENV["APP_KEY"], ENV["APP_SECRET"])
end
end
|
Raise error in the rake task if the credentials were not given
|
diff --git a/jot.podspec b/jot.podspec
index abc1234..def5678 100644
--- a/jot.podspec
+++ b/jot.podspec
@@ -10,7 +10,7 @@ "Devin Foley" => "devin@ifttt.com"
}
#s.source = { :git => "https://github.com/IFTTT/jot.git", :tag => s.version.to_s }
- s.source = { :git => "https://github.com/martinprot/jot"
+ s.source = { :git => "https://github.com/martinprot/jot.git" }
s.social_media_url = 'https://twitter.com/skelovenko'
s.platform = :ios, '7.0'
|
Update pod spec to link to this repo.
|
diff --git a/lib/sinatra/asset_snack/precompile.rb b/lib/sinatra/asset_snack/precompile.rb
index abc1234..def5678 100644
--- a/lib/sinatra/asset_snack/precompile.rb
+++ b/lib/sinatra/asset_snack/precompile.rb
@@ -2,14 +2,16 @@
module Sinatra
module AssetSnack
- extend InstanceMethods
-
def self.precompile!
- self.assets.each do |assets|
- path = File.join(self.app.public_dir, assets[:route])
- FileUtils.mkdir_p File.dirname(path)
- File.open(path, 'w') do |file|
- file.write compile(assets[:paths])[:body]
+ snack = self
+ Module.new do
+ extend snack::InstanceMethods
+ snack.assets.each do |assets|
+ path = File.join(snack.app.public_dir, assets[:route])
+ FileUtils.mkdir_p File.dirname(path)
+ File.open(path, 'w') do |file|
+ file.write compile(assets[:paths])[:body]
+ end
end
end
end
|
Extend anonymous module instead of AssetSnack itself; also be more explicit about it to appease Travis
|
diff --git a/config/initializers/new_framework_defaults.rb b/config/initializers/new_framework_defaults.rb
index abc1234..def5678 100644
--- a/config/initializers/new_framework_defaults.rb
+++ b/config/initializers/new_framework_defaults.rb
@@ -20,6 +20,3 @@
# Require `belongs_to` associations by default. Previous versions had false.
Rails.application.config.active_record.belongs_to_required_by_default = false
-
-# Do not halt callback chains when a callback returns false. Previous versions had true.
-ActiveSupport.halt_callback_chains_on_return_false = true
|
Remove non-existent initializer config option
- By the looks of things, `halt_callback_chains_on_return_false` arrived
in a Rails version prior to 5.1 (there's a separate initializer config
for 5.1) and is now gone, [having been deprecated in
2017](https://github.com/rails/rails/pull/27940).
|
diff --git a/lib/awsraw.rb b/lib/awsraw.rb
index abc1234..def5678 100644
--- a/lib/awsraw.rb
+++ b/lib/awsraw.rb
@@ -1,6 +1,8 @@+require "awsraw/error"
require "awsraw/version"
require "awsraw/s3/canonicalized_resource"
require "awsraw/s3/client"
+require "awsraw/s3/content_md5_header"
require "awsraw/s3/faraday_middleware"
require "awsraw/s3/query_string_signer"
require "awsraw/s3/signature"
|
Add missing requires to top level.
|
diff --git a/lib/barcelona/network/auto_scaling_group.rb b/lib/barcelona/network/auto_scaling_group.rb
index abc1234..def5678 100644
--- a/lib/barcelona/network/auto_scaling_group.rb
+++ b/lib/barcelona/network/auto_scaling_group.rb
@@ -30,7 +30,7 @@ j.MaxBatchSize 1
j.MinInstancesInService desired_capacity
j.WaitOnResourceSignals true
- j.PauseTime "PT1H"
+ j.PauseTime "PT15M"
end
end
end
|
Set CF timeout to 15 minutes
|
diff --git a/db/schema.rb b/db/schema.rb
index abc1234..def5678 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -0,0 +1,71 @@+# encoding: UTF-8
+# This file is auto-generated from the current state of the database. Instead
+# of editing this file, please use the migrations feature of Active Record to
+# incrementally modify your database, and then regenerate this schema definition.
+#
+# Note that this schema.rb definition is the authoritative source for your
+# database schema. If you need to create the application database on another
+# system, you should be using db:schema:load, not running all the migrations
+# from scratch. The latter is a flawed and unsustainable approach (the more migrations
+# you'll amass, the slower it'll run and the greater likelihood for issues).
+#
+# It's strongly recommended that you check this file into your version control system.
+
+ActiveRecord::Schema.define(version: 20140919152929) do
+
+ # These are extensions that must be enabled in order to support this database
+ enable_extension "plpgsql"
+
+ create_table "comments", force: true do |t|
+ t.text "body"
+ t.integer "user_id"
+ t.integer "response_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ add_index "comments", ["response_id"], name: "index_comments_on_response_id", using: :btree
+ add_index "comments", ["user_id"], name: "index_comments_on_user_id", using: :btree
+
+ create_table "questions", force: true do |t|
+ t.string "image_path"
+ t.string "title"
+ t.text "caption"
+ t.string "slug"
+ t.integer "user_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ add_index "questions", ["user_id"], name: "index_questions_on_user_id", using: :btree
+
+ create_table "responses", force: true do |t|
+ t.text "content"
+ t.integer "user_id"
+ t.integer "question_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ add_index "responses", ["question_id"], name: "index_responses_on_question_id", using: :btree
+ add_index "responses", ["user_id"], name: "index_responses_on_user_id", using: :btree
+
+ create_table "users", force: true do |t|
+ t.string "name"
+ t.string "email"
+ t.string "password"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ create_table "votes", force: true do |t|
+ t.integer "user_id"
+ t.integer "response_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ add_index "votes", ["response_id"], name: "index_votes_on_response_id", using: :btree
+ add_index "votes", ["user_id"], name: "index_votes_on_user_id", using: :btree
+
+end
|
Add Schema File to Run Server With Seed File
|
diff --git a/db/schema.rb b/db/schema.rb
index abc1234..def5678 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@ #
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20141017041439) do
+ActiveRecord::Schema.define(version: 20141018023029) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -24,6 +24,10 @@ t.date "date"
t.datetime "created_at"
t.datetime "updated_at"
+ t.string "event_photo_file_name"
+ t.string "event_photo_content_type"
+ t.integer "event_photo_file_size"
+ t.datetime "event_photo_updated_at"
end
create_table "users", force: true do |t|
|
Add migration which adds event_photo field to events table
|
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -8,7 +8,7 @@ end
def update
- if current_user.update_attributes(user_params)
+ if current_user.update(user_params)
flash[:notice] = 'Settings saved'
end
redirect_to root_path
|
Fix Rails 6.1 deprecation warning
|
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -9,4 +9,8 @@ @test = @user.questions
#@question = Question.order("comments_count, created_at DESC")#needtobefor user only
end
+
+ def edit
+ @user = User.friendly.find(params[:id])
+ end
end
|
Create User controller edit method
|
diff --git a/lib/omniauth/strategies/wordpress_hosted.rb b/lib/omniauth/strategies/wordpress_hosted.rb
index abc1234..def5678 100644
--- a/lib/omniauth/strategies/wordpress_hosted.rb
+++ b/lib/omniauth/strategies/wordpress_hosted.rb
@@ -8,7 +8,7 @@
# This is where you pass the options you would pass when
# initializing your consumer from the OAuth gem.
- option :client_options, { token_url: "/oauth/token", authorize_url: "/oauth/authorize" }
+ option :client_options, { }
# These are called after authentication has succeeded. If
@@ -32,7 +32,7 @@ end
def raw_info
- @raw_info ||= access_token.get('http://brandpage.net/oauth/me').parsed
+ access_token.get(options[:client_options][:access_url]).parsed || {}
end
end
end
|
Update endpoints used by WP OAuth Server 3.1.3
|
diff --git a/app/models/clone_ticket_settings.rb b/app/models/clone_ticket_settings.rb
index abc1234..def5678 100644
--- a/app/models/clone_ticket_settings.rb
+++ b/app/models/clone_ticket_settings.rb
@@ -8,7 +8,7 @@ #safe_attributes 'dst_project_id', 'dst_tracker_id', 'copy_attachment', 'copy_children', 'copy_related', 'back_to_status'
#attr_accessible :dst_project_id, :dst_tracker_id, :copy_attachment, :copy_children, :copy_related, :back_to_status
- def find_or_create(project_id)
+ def self.find_or_create(project_id)
own_setting = CloneTicketSettings.where(project_id: project_id).first
unless own_setting.present?
own_setting = CloneTicketSettings.new
|
Change inst method to class method
|
diff --git a/app/presenters/details_presenter.rb b/app/presenters/details_presenter.rb
index abc1234..def5678 100644
--- a/app/presenters/details_presenter.rb
+++ b/app/presenters/details_presenter.rb
@@ -2,12 +2,11 @@
module Presenters
class DetailsPresenter
- attr_reader :content_item_details, :body
+ attr_reader :content_item_details
+ delegate :can_render_govspeak?, :raw_govspeak, to: :body_presenter
def initialize(content_item_details)
@content_item_details = SymbolizeJSON.symbolize(content_item_details)
- @body = content_item_details[:body]
- @body = [@body] if @body.is_a?(Hash)
end
def details
@@ -16,26 +15,57 @@
private
+ def body_presenter
+ @_body_presenter ||=
+ begin
+ body = content_item_details[:body]
+ if body.is_a?(String)
+ SimpleContentPresenter.new(body)
+ else
+ TypedContentPresenter.new(body)
+ end
+ end
+ end
+
def presented_details
return content_item_details unless can_render_govspeak?
govspeak = { content_type: "text/html", content: rendered_govspeak }
- content_item_details.merge(body: body + [govspeak])
- end
-
- def can_render_govspeak?
- return false unless body.respond_to?(:any?)
- has_html = body.any? { |format| format[:content_type] == "text/html" }
- raw_govspeak.present? && !has_html
- end
-
- def raw_govspeak
- return nil unless body.respond_to?(:find)
- govspeak = body.find { |format| format[:content_type] == "text/govspeak" }
- govspeak ? govspeak[:content] : nil
+ content_item_details.merge(body: body_presenter.body + [govspeak])
end
def rendered_govspeak
Govspeak::Document.new(raw_govspeak).to_html
end
+
+ class SimpleContentPresenter
+ attr_reader :body
+
+ def initialize(body)
+ @body = body
+ end
+
+ def can_render_govspeak?; false; end
+
+ def raw_govspeak; nil; end
+ end
+
+ class TypedContentPresenter
+ attr_reader :body
+
+ def initialize(body)
+ @body = Array.wrap(body)
+ end
+
+ def can_render_govspeak?
+ has_html = body.any? { |format| format[:content_type] == "text/html" }
+ raw_govspeak.present? && !has_html
+ end
+
+ def raw_govspeak
+ if (govspeak = body.find { |format| format[:content_type] == "text/govspeak" })
+ govspeak[:content]
+ end
+ end
+ end
end
end
|
Refactor to consolidate logic about body format
Replace the few bits of code related to whether the body is a string,
hash or array-of-hashes with a single decision (in the form of a factory
method). A bit more code but hopefully (perhaps?) easier to understand.
|
diff --git a/lib/alchemy/solidus/alchemy_user_extension.rb b/lib/alchemy/solidus/alchemy_user_extension.rb
index abc1234..def5678 100644
--- a/lib/alchemy/solidus/alchemy_user_extension.rb
+++ b/lib/alchemy/solidus/alchemy_user_extension.rb
@@ -1,6 +1,10 @@ module Alchemy
module Solidus
module AlchemyUserExtension
+ def self.included(klass)
+ klass.include Spree::UserMethods
+ end
+
def spree_roles
if admin?
::Spree::Role.where(name: 'admin')
|
Include Spree::UserMethods in Alchemy::User extension
Without that the Alchemy::User is no proper Spree.user_class
|
diff --git a/app/view_models/effort_show_view.rb b/app/view_models/effort_show_view.rb
index abc1234..def5678 100644
--- a/app/view_models/effort_show_view.rb
+++ b/app/view_models/effort_show_view.rb
@@ -22,7 +22,7 @@ splits.each do |split|
split_row = SplitRow.new(split, related_split_times(split), prior_time)
split_rows << split_row
- prior_time = split_row.times_from_start.last
+ prior_time = split_row.times_from_start.last if split_row.times_from_start.compact.present?
end
end
|
Fix bug that prevented certain split_rows from showing a segment time.
|
diff --git a/app/controllers/api_controller/error_handler.rb b/app/controllers/api_controller/error_handler.rb
index abc1234..def5678 100644
--- a/app/controllers/api_controller/error_handler.rb
+++ b/app/controllers/api_controller/error_handler.rb
@@ -31,6 +31,8 @@ :message => message,
:klass => klass
}
+ err[:backtrace] = backtrace if Rails.env.test?
+
api_log_error("#{klass}: #{message}")
# We don't want to return the stack trace, but only log it in case of an internal error
api_log_error("\n\n#{backtrace}") if kind == :internal_server_error && !backtrace.empty?
|
Include backtrace in error response in tests
I always add the backtrace to the error response when developing a new
feature or debugging to enhance feedback in request specs, which can be
a bit opaque. I'm proposing that we make this a default in the test
environment.
|
diff --git a/lib/fog/aliyun/requests/storage/get_object.rb b/lib/fog/aliyun/requests/storage/get_object.rb
index abc1234..def5678 100644
--- a/lib/fog/aliyun/requests/storage/get_object.rb
+++ b/lib/fog/aliyun/requests/storage/get_object.rb
@@ -30,7 +30,7 @@ end
if block_given?
- http_options[:response_block] = Proc.new
+ http_options[:response_block] = Proc.new {}
end
resources = {
|
Fix "ArgumentError: tried to create Proc object without a block"
|
diff --git a/api/app/controllers/spree/api/line_items_controller.rb b/api/app/controllers/spree/api/line_items_controller.rb
index abc1234..def5678 100644
--- a/api/app/controllers/spree/api/line_items_controller.rb
+++ b/api/app/controllers/spree/api/line_items_controller.rb
@@ -5,7 +5,7 @@
def create
authorize! :read, order
- @line_item = order.line_items.build(params[:line_item])
+ @line_item = order.line_items.build(params[:line_item], :as => :api)
if @line_item.save
respond_with(@line_item, :status => 201, :default_template => :show)
else
@@ -16,7 +16,7 @@ def update
authorize! :read, order
@line_item = order.line_items.find(params[:id])
- if @line_item.update_attributes(params[:line_item])
+ if @line_item.update_attributes(params[:line_item], :as => :api)
respond_with(@line_item, :default_template => :show)
else
invalid_resource!(@line_item)
|
[api] Allow especially overriden attribute setters for line items
Fixes #2916
|
diff --git a/lib/patronus_fati/data_models/common_state.rb b/lib/patronus_fati/data_models/common_state.rb
index abc1234..def5678 100644
--- a/lib/patronus_fati/data_models/common_state.rb
+++ b/lib/patronus_fati/data_models/common_state.rb
@@ -13,13 +13,13 @@ new? || data_dirty? || status_dirty?
end
- def new?
- sync_status & (SYNC_FLAGS[:syncedOnline] | SYNC_FLAGS[:syncedOffline]) > 0
- end
-
def mark_synced
flag = active? ? :syncedOnline : :syncedOffline
self.sync_status = SYNC_FLAGS[flag]
+ end
+
+ def new?
+ !(sync_flag?(:syncedOnline) || sync_flag?(:syncedOffline))
end
def set_sync_flag(flag)
|
Change logic on new? checks to make use of the other helpers
|
diff --git a/lib/sprockets/source_map_comment_processor.rb b/lib/sprockets/source_map_comment_processor.rb
index abc1234..def5678 100644
--- a/lib/sprockets/source_map_comment_processor.rb
+++ b/lib/sprockets/source_map_comment_processor.rb
@@ -1,4 +1,7 @@ # frozen_string_literal: true
+require 'sprockets/uri_utils'
+require 'sprockets/path_utils'
+
module Sprockets
class SourceMapCommentProcessor
def self.call(input)
@@ -21,7 +24,9 @@ uri, _ = env.resolve!(input[:filename], accept: map_type)
map = env.load(uri)
- path = PathUtils.relative_path_from(input[:filename], map.full_digest_path)
+ uri, _ = URIUtils.parse_asset_uri(input[:uri])
+ uri = env.expand_from_root(_[:index_alias]) if _[:index_alias]
+ path = PathUtils.relative_path_from(uri, map.full_digest_path)
asset.metadata.merge(
data: asset.source + (comment % path),
|
Fix index alias source maps
|
diff --git a/cookbooks/chef-server-deploy/libraries/helpers.rb b/cookbooks/chef-server-deploy/libraries/helpers.rb
index abc1234..def5678 100644
--- a/cookbooks/chef-server-deploy/libraries/helpers.rb
+++ b/cookbooks/chef-server-deploy/libraries/helpers.rb
@@ -14,6 +14,6 @@ end
end
-Chef::Node.send(:include, ChefOpsDCC::Helpers)
-Chef::Recipe.send(:include, ChefOpsDCC::Helpers)
-Chef::Resource.send(:include, ChefOpsDCC::Helpers)
+Chef::Node.include ChefOpsDCC::Helpers
+Chef::Recipe.include ChefOpsDCC::Helpers
+Chef::Resource.include ChefOpsDCC::Helpers
|
Fix new chefstyle finding in chef-server-deploy cookbooks
As a follow up we should look at removing these cookbooks as I don't
think they are required anymore.
Signed-off-by: Steven Danna <9ce5770b3bb4b2a1d59be2d97e34379cd192299f@chef.io>
|
diff --git a/NSExtensions.podspec b/NSExtensions.podspec
index abc1234..def5678 100644
--- a/NSExtensions.podspec
+++ b/NSExtensions.podspec
@@ -1,12 +1,12 @@ Pod::Spec.new do |s|
s.name = "NSExtensions"
- s.version = "0.0.2"
+ s.version = "0.0.3"
s.summary = "A collection of useful extensions for standard Cocoa classes."
s.homepage = "https://github.com/skywinder/NSExtensions"
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.authors = { "Anthony Shoumikhin" => "anthony@shoumikh.in",
"Petr Korolev" => "sky4winder+nsextensions@gmail.com"}
- s.source = { :git => "https://github.com/skywinder/NSExtensions.git", :tag => "0.0.2" }
+ s.source = { :git => "https://github.com/skywinder/NSExtensions.git", :tag => "0.0.3" }
s.platform = :ios, '5.1'
s.source_files = 'Xtensions/*.{h,m}'
s.public_header_files = 'Xtensions/*.h'
|
Update podspec to version 0.0.3
|
diff --git a/app/controllers/users/omniauth_callbacks_controller.rb b/app/controllers/users/omniauth_callbacks_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/users/omniauth_callbacks_controller.rb
+++ b/app/controllers/users/omniauth_callbacks_controller.rb
@@ -1,4 +1,8 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
+ def after_omniauth_failure_path_for(scope)
+ new_user_session_path(scope)
+ end
+
def cas
find_user('CAS')
end
|
Fix login failure redirect path
|
diff --git a/app/controllers/users/omniauth_callbacks_controller.rb b/app/controllers/users/omniauth_callbacks_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/users/omniauth_callbacks_controller.rb
+++ b/app/controllers/users/omniauth_callbacks_controller.rb
@@ -2,8 +2,13 @@
def github
@user = User.from_omniauth(request.env["omniauth.auth"])
- sign_in @user
- redirect_to root_path
+ if @user.sign_in_count > 1
+ sign_in @user
+ redirect_to user_settings_path(@user)
+ else
+ sign_in @user
+ redirect_to root_path
+ end
end
def dev_sign_in
|
Change after sign-in behaviour depending on sign in count
|
diff --git a/app/helpers/budgets_helper.rb b/app/helpers/budgets_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/budgets_helper.rb
+++ b/app/helpers/budgets_helper.rb
@@ -42,4 +42,9 @@ def investment_tags_select_options
Budget::Investment.tags_on(:valuation).order(:name).select(:name).distinct
end
+
+ def budget_published?(budget)
+ !budget.drafting? || current_user&.administrator?
+ end
+
end
|
Add budget_published? helper method to BudgetHelper
We need to check if the budget is in drafting phase to avoid showing
it to the users, unless the current user is an administrator.
|
diff --git a/db/migrate/20100811222824_allow_null_in_posts_columns.rb b/db/migrate/20100811222824_allow_null_in_posts_columns.rb
index abc1234..def5678 100644
--- a/db/migrate/20100811222824_allow_null_in_posts_columns.rb
+++ b/db/migrate/20100811222824_allow_null_in_posts_columns.rb
@@ -0,0 +1,17 @@+class AllowNullInPostsColumns < ActiveRecord::Migration
+ def self.up
+ change_column :posts, :headline, :string, :default => "", :null => true
+ change_column :posts, :url, :string, :default => "", :null => true
+ change_column :posts, :body, :text, :default => "", :null => true
+ change_column :posts, :guid, :string, :default => "", :null => true
+ change_column :posts, :summary, :text, :default => "", :null => true
+ end
+
+ def self.down
+ change_column :posts, :headline, :string, :default => "", :null => false
+ change_column :posts, :url, :string, :default => "", :null => false
+ change_column :posts, :body, :text, :default => "", :null => false
+ change_column :posts, :guid, :string, :default => "", :null => false
+ change_column :posts, :summary, :text, :default => "", :null => false
+ end
+end
|
Allow null in posts columns
|
diff --git a/db/migrate/20161014194032_add_tags_to_articles.rb b/db/migrate/20161014194032_add_tags_to_articles.rb
index abc1234..def5678 100644
--- a/db/migrate/20161014194032_add_tags_to_articles.rb
+++ b/db/migrate/20161014194032_add_tags_to_articles.rb
@@ -1,5 +1,5 @@ class AddTagsToArticles < ActiveRecord::Migration[4.2]
def change
- add_column :articles, :tags, :string, default: [].to_json, array: true
+ add_column :articles, :tags, :string
end
end
|
Remove default to make it work with both sqlite and postgres
Postgres doesn't accept array: true and default: string("[]"). So,
simply remove the default.
Anyway, the next migration changes it to a simple string column.
|
diff --git a/test/sepa/banks/nordea/nordea_renew_cert_request_soap_builder_test.rb b/test/sepa/banks/nordea/nordea_renew_cert_request_soap_builder_test.rb
index abc1234..def5678 100644
--- a/test/sepa/banks/nordea/nordea_renew_cert_request_soap_builder_test.rb
+++ b/test/sepa/banks/nordea/nordea_renew_cert_request_soap_builder_test.rb
@@ -0,0 +1,28 @@+require 'test_helper'
+
+class NordeaRenewCertRequestSoapBuilderTest < ActiveSupport::TestCase
+ setup do
+ @params = nordea_renew_certificate_params
+
+ # Convert the keys here since the conversion is usually done by the client and these tests
+ # bypass the client
+ @params[:own_signing_certificate] = x509_certificate(@params[:own_signing_certificate])
+ @params[:signing_private_key] = rsa_key(@params[:signing_private_key])
+
+ soap_builder = Sepa::SoapBuilder.new(@params)
+ @doc = Nokogiri::XML(soap_builder.to_xml)
+ end
+
+ test "validates against schema" do
+ errors = []
+
+ Dir.chdir(SCHEMA_PATH) do
+ xsd = Nokogiri::XML::Schema(IO.read('soap.xsd'))
+ xsd.validate(@doc).each do |error|
+ errors << error
+ end
+ end
+
+ assert errors.empty?, "The following schema validations failed:\n#{errors.join("\n")}"
+ end
+end
|
Add test suite for Nordea renew certificate soap
|
diff --git a/test/redimap/version.rb b/test/redimap/version.rb
index abc1234..def5678 100644
--- a/test/redimap/version.rb
+++ b/test/redimap/version.rb
@@ -3,7 +3,7 @@ require_relative '../../lib/redimap/version'
-describe Redimap::VERSION do
+describe "Redimap::VERSION" do
subject { Redimap::VERSION }
|
Fix string description of Redimap::VERSION test.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.