diff stringlengths 65 26.7k | message stringlengths 7 9.92k |
|---|---|
diff --git a/lib/checkout_ru/address.rb b/lib/checkout_ru/address.rb
index abc1234..def5678 100644
--- a/lib/checkout_ru/address.rb
+++ b/lib/checkout_ru/address.rb
@@ -4,6 +4,7 @@ class Address < Entity
property :postindex
property :street_fias_id, :from => :streetFiasId
+ property :street
property :house
property :housing
property :building
| Add an undocumented street property to Address |
diff --git a/lib/convergence/command.rb b/lib/convergence/command.rb
index abc1234..def5678 100644
--- a/lib/convergence/command.rb
+++ b/lib/convergence/command.rb
@@ -19,7 +19,9 @@ elsif @opts[:apply]
Convergence::Command::Apply
end
- unless execute_klass.nil?
+ if execute_klass.nil?
+ puts @opts
+ else
execute_klass.new(@opts, config: @config).execute
end
end
| Change it to display help when executed without option
|
diff --git a/lib/eventbrite/attendee.rb b/lib/eventbrite/attendee.rb
index abc1234..def5678 100644
--- a/lib/eventbrite/attendee.rb
+++ b/lib/eventbrite/attendee.rb
@@ -23,5 +23,9 @@ :email, :first_name, :gender, :home_phone, :job_title,
:last_name, :name, :prefix, :suffix, :website, :work_phone,
to: :profile, allow_nil: true
+ def inspect
+ keys = [:id, :first_name, :last_name]
+ "#<#{self.class.name}#{keys.collect { |key| " #{key}=#{send(key).inspect}" }.join}>"
+ end
end
end | Add first and last name to Attendee.inspect
|
diff --git a/Casks/navicat-for-mysql.rb b/Casks/navicat-for-mysql.rb
index abc1234..def5678 100644
--- a/Casks/navicat-for-mysql.rb
+++ b/Casks/navicat-for-mysql.rb
@@ -1,6 +1,6 @@ cask :v1 => 'navicat-for-mysql' do
- version '11.1.9' # navicat-premium.rb and navicat-for-* should be upgraded together
- sha256 'dcb8e15b134bda9b7c416fac54bd4e1d233cf31f8f6f9443a530dffc0adf732e'
+ version '11.1.10' # navicat-premium.rb and navicat-for-* should be upgraded together
+ sha256 '5e7ae59235e67547c2deacc2fa1b45dc4bfa4fef5f25ac4fff901df3bfaa9821'
url "http://download.navicat.com/download/navicat#{version.sub(%r{^(\d+)\.(\d+).*},'\1\2')}_mysql_en.dmg"
name 'Navicat for MySQL'
| Upgrade 'Navicat for MySQL.app' to v11.1.10
|
diff --git a/lib/mongo_session_store.rb b/lib/mongo_session_store.rb
index abc1234..def5678 100644
--- a/lib/mongo_session_store.rb
+++ b/lib/mongo_session_store.rb
@@ -6,18 +6,17 @@ def self.collection_name=(name)
@collection_name = name
- if defined?(MongoStore::Session)
- MongoStore::Session.reset_collection
- elsif defined?(MongoidStore::Session)
+ if defined?(MongoidStore::Session)
MongoidStore::Session.store_in \
:collection => MongoSessionStore.collection_name
end
+ if defined?(MongoStore::Session)
+ MongoStore::Session.reset_collection
+ end
+
@collection_name
end
-
- # default collection name for all the stores
- self.collection_name = "sessions"
end
if defined?(Mongoid)
@@ -25,3 +24,6 @@ elsif defined?(Mongo)
require "mongo_session_store/mongo_store"
end
+
+# Default collection name for all the stores.
+MongoSessionStore.collection_name = "sessions"
| Fix collection_name= with multiples stores loaded
Wouldn't set the collection name on all stores, just the first one
checked.
|
diff --git a/lib/moonshot/ssh_config.rb b/lib/moonshot/ssh_config.rb
index abc1234..def5678 100644
--- a/lib/moonshot/ssh_config.rb
+++ b/lib/moonshot/ssh_config.rb
@@ -2,5 +2,10 @@ class SSHConfig
attr_accessor :ssh_identity_file
attr_accessor :ssh_user
+
+ def initialize
+ @ssh_identity_file = ENV['MOONSHOT_SSH_KEY_FILE']
+ @ssh_user = ENV['MOONSHOT_SSH_USER']
+ end
end
end
| Fix the usege of MOONSHOT_SSH_USER and MOONSHOT_SSH_KEY_FILE environment variables
|
diff --git a/test/support/mongrel_helper.rb b/test/support/mongrel_helper.rb
index abc1234..def5678 100644
--- a/test/support/mongrel_helper.rb
+++ b/test/support/mongrel_helper.rb
@@ -6,7 +6,7 @@ def setup
check_mongrel
`cd example && m2sh load -config mongrel2.conf`
- self.pid = Process.spawn("bundle exec foreman start --procfile=example/Procfile", pgroup: true)
+ self.pid = Process.spawn("bundle exec foreman start --procfile=example/Procfile", pgroup: true, out: "/dev/null", err: "/dev/null")
wait_for_pid('example/tmp/mongrel2.pid')
end
| Revert "Display output from foreman processes to debug travis issues"
This reverts commit 91c78c4b5db2f08d8b94c534702c5dccddc3a313.
Conflicts:
test/support/mongrel_helper.rb
|
diff --git a/spec/controllers/search_controller_spec.rb b/spec/controllers/search_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/search_controller_spec.rb
+++ b/spec/controllers/search_controller_spec.rb
@@ -6,9 +6,6 @@ end
describe 'query is a person' do
- @lola = FactoryGirl.create(:person, :diaspora_handle => "lola@example.org",
- :profile => FactoryGirl.build(:profile, :first_name => "Lola",
- :last_name => "w", :searchable => false))
it 'goes to people index page' do
get :search, :q => 'eugene'
expect(response).to be_redirect
| Remove a dangling "lola" object creation
It's never used and possibly was left unnoticed by some refactoring.
closes #7230
|
diff --git a/test/test_subclass_tracking.rb b/test/test_subclass_tracking.rb
index abc1234..def5678 100644
--- a/test/test_subclass_tracking.rb
+++ b/test/test_subclass_tracking.rb
@@ -1,7 +1,10 @@ require_relative 'helper'
class TestSubclassTracking < Sidetiq::TestCase
- class Foo
+ class Base
+ end
+
+ class Foo < Base
extend Sidetiq::SubclassTracking
end
| Add extra test for SubclassTracking.
|
diff --git a/lib/buildr/core/jrebel.rb b/lib/buildr/core/jrebel.rb
index abc1234..def5678 100644
--- a/lib/buildr/core/jrebel.rb
+++ b/lib/buildr/core/jrebel.rb
@@ -25,6 +25,7 @@
def rebel_jar
if jrebel_home
+ # jrebel_home may point to jrebel.jar directly
File.directory?(jrebel_home) ? File.join(jrebel_home, 'jrebel.jar') : jrebel_home
end
end
| Add comment to help prevent future regressions
git-svn-id: d8f3215415546ce936cf3b822120ca56e5ebeaa0@1038832 13f79535-47bb-0310-9956-ffa450edef68
|
diff --git a/ext/platform_dependencies.rb b/ext/platform_dependencies.rb
index abc1234..def5678 100644
--- a/ext/platform_dependencies.rb
+++ b/ext/platform_dependencies.rb
@@ -3,14 +3,15 @@ installer = Gem::DependencyInstaller.new
begin
- if RUBY_VERSION >= '2.0'
- puts "Installing byebug for Ruby #{RUBY_VERSION}"
+ ruby_version = RUBY_VERSION.sub /^[a-z-]*/, ''
+ if ruby_version >= '2.0'
+ puts "Installing byebug for Ruby #{ruby_version}"
installer.install 'byebug'
- elsif RUBY_VERSION >= '1.9'
- puts "Installing debugger for Ruby #{RUBY_VERSION}"
+ elsif ruby_version >= '1.9'
+ puts "Installing debugger for Ruby #{ruby_version}"
installer.install 'debugger'
- elsif RUBY_VERSION >= '1.8'
- puts "Installing ruby-debug for Ruby #{RUBY_VERSION}"
+ elsif ruby_version >= '1.8'
+ puts "Installing ruby-debug for Ruby #{ruby_version}"
installer.install 'ruby-debug'
end
rescue => e
| Fix ruby version matcher to check for leading 'ruby-'
|
diff --git a/lib/git-cleanup/helper.rb b/lib/git-cleanup/helper.rb
index abc1234..def5678 100644
--- a/lib/git-cleanup/helper.rb
+++ b/lib/git-cleanup/helper.rb
@@ -1,6 +1,6 @@ class GitCleanup
module Helper
- def self.boolean(question)
+ def self.boolean(question, &block)
puts "#{question} (y/n)"
answer = STDIN.gets.chomp
if answer == 'y'
@@ -8,7 +8,7 @@ elsif answer == 'n'
return false
else
- boolean(question)
+ boolean(question, &block)
end
end
end
| Fix bug if you provided invalid y/n response |
diff --git a/lib/jumble/rest/client.rb b/lib/jumble/rest/client.rb
index abc1234..def5678 100644
--- a/lib/jumble/rest/client.rb
+++ b/lib/jumble/rest/client.rb
@@ -22,7 +22,7 @@
def method_missing(name, *args, &block)
client.send(name, *args, &block)
- rescue ::Twitter::Error::TooManyRequests, ::Twitter::Error::Forbidden
+ rescue ::Twitter::Error::TooManyRequests
# FIXME We should not use these infinite retries
retry
end
| Remove excess exception from rescue
|
diff --git a/lib/mabbre/interpreter.rb b/lib/mabbre/interpreter.rb
index abc1234..def5678 100644
--- a/lib/mabbre/interpreter.rb
+++ b/lib/mabbre/interpreter.rb
@@ -6,7 +6,7 @@
def method_missing(name, *args)
matched = nil
- if self.class.tracked_methods(MAbbre).one? {|m| matched = m if m =~ /\A#{name}/ }
+ if self.class.tracked_methods(MAbbre).one? {|m| matched = m if m.to_s =~ /\A#{name}/ }
send(matched, *args)
else
super
| Modify code to be compatible with Ruby 1.8.7.
|
diff --git a/lib/models/pending_job.rb b/lib/models/pending_job.rb
index abc1234..def5678 100644
--- a/lib/models/pending_job.rb
+++ b/lib/models/pending_job.rb
@@ -8,7 +8,7 @@
db.transaction do
ids = select_map(:query_id)
- filter(query_id: ids).delete
+ filter(query_id: ids).delete if ids.any?
end
ids
| Reduce database load when checking for pending jobs
|
diff --git a/lib/morph/limit_output.rb b/lib/morph/limit_output.rb
index abc1234..def5678 100644
--- a/lib/morph/limit_output.rb
+++ b/lib/morph/limit_output.rb
@@ -26,6 +26,9 @@ STDOUT.sync = true
STDERR.sync = true
+stdout_buffer = ''
+stderr_buffer = ''
+
Open3.popen3(command) do |_stdin, stdout, stderr, wait_thr|
streams = [stdout, stderr]
until streams.empty?
@@ -35,11 +38,26 @@ next
end
+ on_stdout_stream = io.fileno == stdout.fileno
# Just send this stuff straight through
- stream = io.fileno == stdout.fileno ? STDOUT : STDERR
- stream << io.readpartial(1024)
+ buffer = on_stdout_stream ? stdout_buffer : stderr_buffer
+ s = io.readpartial(1)
+ buffer << s
+ if s == "\n"
+ if on_stdout_stream
+ STDOUT << buffer
+ stdout_buffer = ''
+ else
+ STDERR << buffer
+ stderr_buffer = ''
+ end
+ end
end
end
+
+ # Output whatever is left in the buffers
+ STDOUT << stdout_buffer
+ STDERR << stderr_buffer
exit_status = wait_thr.value.exitstatus
end
| Write out one line at a time
|
diff --git a/lib/processors/rmagick.rb b/lib/processors/rmagick.rb
index abc1234..def5678 100644
--- a/lib/processors/rmagick.rb
+++ b/lib/processors/rmagick.rb
@@ -5,7 +5,7 @@ tmp_file = Tempfile.new(["",".tif"])
cat = @instance || Magick::Image.read(@source.to_s).first
cat.crop!(@x, @y, @w, @h) unless [@x, @y, @w, @h].compact == []
- cat.write tmp_file.path.to_s, "-compress none"
+ cat.write(tmp_file.path.to_s){self.compress = "none"}
return tmp_file
end
| Modify syntax to try to skip compression on convert call
|
diff --git a/src/supermarket/spec/support/shared_examples/exportable_shared.rb b/src/supermarket/spec/support/shared_examples/exportable_shared.rb
index abc1234..def5678 100644
--- a/src/supermarket/spec/support/shared_examples/exportable_shared.rb
+++ b/src/supermarket/spec/support/shared_examples/exportable_shared.rb
@@ -11,7 +11,7 @@ end
it 'has header row of model\'s attributes' do
- expect(reparsed_csv.first).to eq(exportable_thing.attribute_names)
+ expect(reparsed_csv.first).to match_array(exportable_thing.attribute_names)
end
it 'has a row for a model in a query' do
| Use match_array in test to compare arrays
Introduced in 4.2, ActiveRecord's #attribute_names does not return
attribute names in any particular order. That was a byproduct of
the implementation in <= 4.1. This particular test now only confirms
that all attributes are _present_ in the header row of the CSV export.
Other tests are confirming order.
Signed-off-by: Robb Kidd <11cd4f9ba93acb67080ee4dad8d03929f9e64bf2@chef.io>
|
diff --git a/samples/cloud_front.rb b/samples/cloud_front.rb
index abc1234..def5678 100644
--- a/samples/cloud_front.rb
+++ b/samples/cloud_front.rb
@@ -13,5 +13,5 @@
puts "First ten distribution items:"
-p cloud_front.get("/distribution", "MaxItems" => 10)
+p cloud_front.get("/distribution", :params => {"MaxItems" => 10})
| Update samples to use :params
|
diff --git a/qa/qa/page/label/index.rb b/qa/qa/page/label/index.rb
index abc1234..def5678 100644
--- a/qa/qa/page/label/index.rb
+++ b/qa/qa/page/label/index.rb
@@ -11,10 +11,11 @@ end
def go_to_new_label
- wait(reload: false) do
- within_element(:label_svg) do
- has_css?('.js-lazy-loaded')
- end
+ # The 'labels.svg' takes a fraction of a second to load after which the "New label" button shifts up a bit
+ # This can cause webdriver to miss the hit so we wait for the svg to load (implicitly with has_css?)
+ # before clicking the button.
+ within_element(:label_svg) do
+ has_css?('.js-lazy-loaded')
end
click_element :label_create_new
| Add comments explaining the wait
|
diff --git a/spec/acceptance/acceptance_test_helpers.rb b/spec/acceptance/acceptance_test_helpers.rb
index abc1234..def5678 100644
--- a/spec/acceptance/acceptance_test_helpers.rb
+++ b/spec/acceptance/acceptance_test_helpers.rb
@@ -35,6 +35,7 @@ visit '/'
attach_file('File', File.expand_path("spec/fixtures/#{ filename }"))
click_button 'Upload image'
+ Image.last.update_attribute(:public, true)
end
end
| Make all images uploaded via this helper public for now
|
diff --git a/lib/troo/configuration.rb b/lib/troo/configuration.rb
index abc1234..def5678 100644
--- a/lib/troo/configuration.rb
+++ b/lib/troo/configuration.rb
@@ -43,7 +43,7 @@ end
def api_url
- 'https://api.trello.com/1'
+ config.fetch('api_url', 'https://api.trello.com/1')
end
def api_key
@@ -65,11 +65,11 @@ end
def main_db
- config.fetch('main_db', '')
+ config.fetch('main_db', '1')
end
def test_db
- config.fetch('test_db', '')
+ config.fetch('test_db', '2')
end
end
end
| Add sensible defaults to Configuration class.
|
diff --git a/vendor/plugins/themes/lib/theme_server.rb b/vendor/plugins/themes/lib/theme_server.rb
index abc1234..def5678 100644
--- a/vendor/plugins/themes/lib/theme_server.rb
+++ b/vendor/plugins/themes/lib/theme_server.rb
@@ -1,7 +1,7 @@ # Allow the metal piece to run in isolation
require(File.dirname(__FILE__) + "/../../config/environment") unless defined?(Rails)
-# Servers theme files from the them directory without touching Rails too much
+# Serves theme files from the theme directory without touching Rails too much
class ThemeServer
def initialize(app)
@@ -15,13 +15,14 @@ if (file_path = Rails.root.join("themes", RefinerySetting[:theme], relative_path)).exist?
# generate an etag for client-side caching.
etag = Digest::MD5.hexdigest("#{file_path.to_s}#{file_path.mtime}")
- unless (env["HTTP_IF_NONE_MATCH"] == etag and RefinerySetting.find_or_set(:themes_use_etags, false))
+ unless (env["HTTP_IF_NONE_MATCH"] == etag and RefinerySetting.find_or_set(:themes_use_etags, false) == true)
[200, {
"Content-Type" => Rack::Mime.mime_type(file_path.extname),
+ "Cache-Control" => "public",
"ETag" => etag
}, file_path.open]
else
- [304, {"Content-Type" => Rack::Mime.mime_type(file_path.extname)}, "Not Modified"]
+ [304, {}, []]
end
else
[404, {"Content-Type" => "text/html"}, ["Not Found"]]
| Send a blank response with 304
|
diff --git a/lib/migration_helper.rb b/lib/migration_helper.rb
index abc1234..def5678 100644
--- a/lib/migration_helper.rb
+++ b/lib/migration_helper.rb
@@ -6,14 +6,14 @@ end
module InstanceMethods
- def userstamps(include_deleted_by = false)
- column(Ddb::Userstamp.compatibility_mode ? :created_by : :creator_id, :integer)
- column(Ddb::Userstamp.compatibility_mode ? :updated_by : :updater_id, :integer)
- column(Ddb::Userstamp.compatibility_mode ? :deleted_by : :deleter_id, :integer) if include_deleted_by
+ def userstamps(include_deleted_by = false, *args)
+ column(Ddb::Userstamp.compatibility_mode ? :created_by : :creator_id, :integer, *args)
+ column(Ddb::Userstamp.compatibility_mode ? :updated_by : :updater_id, :integer, *args)
+ column(Ddb::Userstamp.compatibility_mode ? :deleted_by : :deleter_id, :integer, *args) if include_deleted_by
end
end
end
end
end
-ActiveRecord::ConnectionAdapters::TableDefinition.send(:include, Ddb::Userstamp::MigrationHelper)+ActiveRecord::ConnectionAdapters::TableDefinition.send(:include, Ddb::Userstamp::MigrationHelper)
| Allow extra parameters to be passed on to the column definition.
This follows ActiveRecord's `timestamps` migration table definition helper method.
|
diff --git a/lib/mobile-fu/helper.rb b/lib/mobile-fu/helper.rb
index abc1234..def5678 100644
--- a/lib/mobile-fu/helper.rb
+++ b/lib/mobile-fu/helper.rb
@@ -6,15 +6,33 @@
def stylesheet_link_tag_with_mobilization(*sources)
mobilized_sources = Array.new
+
+ # Figure out where stylesheets live, which differs depending if the asset
+ # pipeline is used or not.
+ stylesheets_dir = config.stylesheets_dir # Rails.root/public/stylesheets
+
+ # Look for mobilized stylesheets in the app/assets path if asset pipeline
+ # is enabled, because public/stylesheets will be missing in development
+ # mode without precompiling assets first, and may also contain multiple
+ # stylesheets with similar names because of checksumming during
+ # precompilation.
+ if Rails.application.config.respond_to?(:assets) # don't break pre-rails3.1
+ if Rails.application.config.assets.enabled
+ stylesheets_dir = File.join(Rails.root, 'app/assets/stylesheets/')
+ end
+ end
+
+ device_names = respond_to?(:is_mobile_device?) && is_mobile_device? ? ['mobile', mobile_device.downcase] : []
+
sources.each do |source|
mobilized_sources << source
- device_names = respond_to?(:is_mobile_device?) && is_mobile_device? ? ['mobile', mobile_device.downcase] : []
+ device_names.compact.each do |device_name|
+ # support ERB and/or SCSS extensions (e.g., mobile.css.erb, mobile.css.scss.erb)
+ possible_source = source.to_s.sub(/\.css.*$/, '') + "_#{device_name}"
- device_names.compact.each do |device_name|
- possible_source = "#{source.to_s.gsub '.css', ''}_#{device_name}.css"
- path = File.join config.stylesheets_dir, possible_source
- mobilized_sources << possible_source if File.exist?(path)
+ mobilized_files = Dir.glob(File.join(stylesheets_dir, "#{possible_source}.css*")).map { |f| f.sub(stylesheets_dir, '') }
+ mobilized_sources += mobilized_files.map { |f| f.sub(/\.css.*/, '') }
end
end
| Fix mobilized stylesheets to work with rails 3.1+ asset pipeline:
Look for stylesheets in Rails.root/app/assets/stylesheets instead of
public/stylesheets when the asset pipeline is enabled.
Support ERB and SASS stylesheets (.css.erb, .css.scss.erb) files in addition
to simple .css files.
|
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 @@ env = ENV['RAILS_ENV'] || 'development'
case env
when 'development','test'
- "local.alphagov.co.uk:3001"
+ "local.alphagov.co.uk:3002"
when 'production'
"api.alpha.gov.uk"
else
| Make app talk to imminence properly in development
|
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,13 +2,4 @@ # Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
-
- before_filter :authorize_miniprofiler
-
- def authorize_miniprofiler
- # Only show Miniprofiler stats in production to mlandauer
- if current_user && current_user.nickname == "mlandauer"
- Rack::MiniProfiler.authorize_request
- end
- end
end
| Revert "Show profiler info to mlandauer in production"""
This reverts commit 511d285baa00ea0664e3bc1be5ae0a9254ec560b.
|
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,6 +1,7 @@ class ApplicationController < ActionController::Base
include GDS::SSO::ControllerMethods
+ before_action :set_paper_trail_whodunnit
before_action :authenticate_user!
before_action :exclude_all_users_except_admins_during_maintenance
| Add `before_action :set_paper_trail_whodunnit` to ApplicationController
- As of PaperTrail 5, PaperTrail doesn't set this automatically, so we
have to set it ourselves. See
https://github.com/paper-trail-gem/paper_trail#setting-whodunnit-with-a-controller-callback.
|
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
@@ -4,6 +4,6 @@ protect_from_forgery with: :exception
# force the user to redirect to the login page if the user was not logged in.
- before_action :authenticate_user!
+ # before_action :authenticate_user!
end
| Allow unauthenticated user access to site
|
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,6 +1,8 @@ class ApplicationController < Sinatra::Base
set :views, File.expand_path('../../views', __FILE__)
set :public_folder, File.expand_path('../../../public', __FILE__)
+
+ enable :sessions
get '/' do
slim :index
| Enable sessions. Used to implement user authentication
|
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
@@ -9,14 +9,13 @@ protect_from_forgery with: :exception
def after_sign_in_path_for(resource)
- return worker_confirmation_path if resource.worker? && resource.worker.has_password?
- return new_company_path if resource.manager? && !resource.has_company?
+ return new_company_path if resource.manager? && !resource.has_company?
dashboard_root_path
end
def authenticate_manager!
- authenticate_user! && current_user.manager?
+ redirect_to new_user_session_path unless user_signed_in? && current_user.manager?
end
decent_configuration do
| Remove condicoes para redirect depois do login e corrige autenticacao do manager
|
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,7 +1,7 @@ require "application_responder"
class ApplicationController < ActionController::Base
- self.responder = ApplicationResponder
+ self.responder = ActionController::Responder
respond_to :html
# Prevent CSRF attacks by raising an exception.
| Fix double flash responders on sign on
|
diff --git a/lib/rolify/configure.rb b/lib/rolify/configure.rb
index abc1234..def5678 100644
--- a/lib/rolify/configure.rb
+++ b/lib/rolify/configure.rb
@@ -45,7 +45,7 @@ role_cnames = [ "Role" ] if role_cnames.empty?
role_cnames.each do |role_cname|
role_class = role_cname.constantize
- if role_class.superclass.to_s == "ActiveRecord::Base" && !role_class.table_exists?
+ if role_class.connected? && role_class.superclass.to_s == "ActiveRecord::Base" && !role_class.table_exists?
warn "[WARN] table '#{role_cname}' doesn't exist. Did you run the migration ? Ignoring rolify config."
return false
end
@@ -53,4 +53,4 @@ true
end
end
-end+end
| Make sure we are connected before table_exists?
Because otherwise it will bail because it cannot connect to a DB when doing things like precompiling assets.
Test with:
```
env -i GEM_PATH=$GEM_PATH \
PATH=$PATH \
DATABASE_URL=postgres://user:pass@127.0.0.1/dbname \
/bin/sh -c 'bundle exec rake --trace assets:precompile'
``` |
diff --git a/app/policies/renalware/bag_type_policy.rb b/app/policies/renalware/bag_type_policy.rb
index abc1234..def5678 100644
--- a/app/policies/renalware/bag_type_policy.rb
+++ b/app/policies/renalware/bag_type_policy.rb
@@ -0,0 +1,16 @@+module Renalware
+
+ class BagTypePolicy < ApplicationPolicy
+ def new? ; has_privilege? end
+ def create? ; has_privilege? end
+ def index? ; has_privilege? end
+ def edit? ; has_privilege? end
+ def destroy? ; has_privilege? end
+
+ private
+ def has_privilege?
+ user.has_role?(:admin) || user.has_role?(:super_admin)
+ end
+
+ end
+end | Set up pundit policy for bag types.
|
diff --git a/lib/search_flip/json.rb b/lib/search_flip/json.rb
index abc1234..def5678 100644
--- a/lib/search_flip/json.rb
+++ b/lib/search_flip/json.rb
@@ -1,8 +1,17 @@
module SearchFlip
- module JSON
+ class JSON
+ @default_options = {
+ mode: :custom,
+ use_to_json: true
+ }
+
+ def self.default_options
+ @default_options
+ end
+
def self.generate(obj)
- Oj.dump(obj, mode: :custom, use_to_json: true)
+ Oj.dump(obj, default_options)
end
end
end
| Set JSON options via customizable default options
|
diff --git a/lib/encrypt.rb b/lib/encrypt.rb
index abc1234..def5678 100644
--- a/lib/encrypt.rb
+++ b/lib/encrypt.rb
@@ -12,6 +12,7 @@ end
def decrypt key
+ return nil unless self.bytesize > 32
cipher = OpenSSL::Cipher::AES256.new(:CTR)
cipher.decrypt
salt = self.byteslice(0..15)
| Return nil if bytesize is less than 32.
|
diff --git a/lib/hue/cli.rb b/lib/hue/cli.rb
index abc1234..def5678 100644
--- a/lib/hue/cli.rb
+++ b/lib/hue/cli.rb
@@ -25,17 +25,25 @@ end
end
- desc 'light ID STATE', 'Access a light'
+ desc 'light ID STATE [COLOR]', 'Access a light'
+ long_desc <<-LONGDESC
+ Examples: \n
+ hue light 1 on --hue 12345 \n
+ hue light 1 --bri 25 \n
+ hue light 1 --alert lselect \n
+ hue light 1 off
+ LONGDESC
option :hue, :type => :numeric
- option :saturation, :type => :numeric
- option :brightness, :type => :numeric
+ option :sat, :type => :numeric
+ option :bri, :type => :numeric
+ option :alert, :type => :string
def light(id, state = nil)
light = client.light(id)
puts light.name
body = options.dup
- body[:on] = state unless state.nil?
- light.set_state(body) if body.length > 0
+ body[:on] = (state == 'on' || !(state == 'off'))
+ puts light.set_state(body) if body.length > 0
end
private
| Update on/off state and update brightness, saturation, alert
|
diff --git a/lib/iprange.rb b/lib/iprange.rb
index abc1234..def5678 100644
--- a/lib/iprange.rb
+++ b/lib/iprange.rb
@@ -10,18 +10,21 @@ end
def remove(range)
- @redis.irem(@redis_key, range)
- @redis.del(metadata_key(range))
+ @redis.pipelined do
+ @redis.irem(@redis_key, range)
+ @redis.del(metadata_key(range))
+ end
end
def add(range, metadata={})
ipaddr_range = IPAddr.new(range).to_range
+ range = "#{metadata[:key]}:#{range}" if metadata[:key]
+ hash = metadata_key(range)
- range = "#{metadata[:key]}:#{range}" if metadata[:key]
-
- @redis.iadd(@redis_key, ipaddr_range.first.to_i, ipaddr_range.last.to_i, range)
- hash = metadata_key(range)
- @redis.mapped_hmset(hash, metadata) unless metadata.empty?
+ @redis.pipelined do
+ @redis.iadd(@redis_key, ipaddr_range.first.to_i, ipaddr_range.last.to_i, range)
+ @redis.mapped_hmset(hash, metadata) unless metadata.empty?
+ end
end
def find(ip)
| Use pipeline in Redis operations
|
diff --git a/lib/twilio-ruby/util.rb b/lib/twilio-ruby/util.rb
index abc1234..def5678 100644
--- a/lib/twilio-ruby/util.rb
+++ b/lib/twilio-ruby/util.rb
@@ -1,7 +1,15 @@ module Twilio
module Util
def url_encode(hash)
- hash.to_a.map {|p| p.map {|e| CGI.escape e.to_s}.join '='}.join '&'
+ hash.to_a.map {|p| p.map {|e| CGI.escape get_string(e)}.join '='}.join '&'
+ end
+
+ def get_string(obj)
+ if obj.respond_to?(:strftime)
+ obj.strftime('%Y-%m-%d')
+ else
+ obj.to_s
+ end
end
end
end
| Enforce proper date formatting for Time params
|
diff --git a/pg_examiner.gemspec b/pg_examiner.gemspec
index abc1234..def5678 100644
--- a/pg_examiner.gemspec
+++ b/pg_examiner.gemspec
@@ -18,8 +18,7 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ['lib']
- spec.add_dependency 'pg'
-
+ spec.add_development_dependency 'pg'
spec.add_development_dependency 'bundler', '~> 1.6'
spec.add_development_dependency 'rake'
spec.add_development_dependency 'rspec'
| Make the pg gem a development dependency so things can work on JRuby.
|
diff --git a/lib/graphql/query/null_context.rb b/lib/graphql/query/null_context.rb
index abc1234..def5678 100644
--- a/lib/graphql/query/null_context.rb
+++ b/lib/graphql/query/null_context.rb
@@ -3,12 +3,18 @@ class Query
# This object can be `ctx` in places where there is no query
class NullContext
+ class NullWarden < GraphQL::Schema::Warden
+ def visible?(t); true; end
+ def visible_field?(t); true; end
+ def visible_type?(t); true; end
+ end
+
attr_reader :schema, :query, :warden
def initialize
@query = nil
@schema = GraphQL::Schema.new
- @warden = GraphQL::Schema::Warden.new(
+ @warden = NullWarden.new(
GraphQL::Filter.new,
context: self,
schema: @schema,
| Fix NullContext for better warden behaviors
|
diff --git a/lib/metasploit/cache/ephemeral.rb b/lib/metasploit/cache/ephemeral.rb
index abc1234..def5678 100644
--- a/lib/metasploit/cache/ephemeral.rb
+++ b/lib/metasploit/cache/ephemeral.rb
@@ -7,7 +7,8 @@ # Runs transaction on `destination_class` using temporary from the connection pool that is checked in to the
# connection pool at the end of `block`.
#
- # @param destination [Class<ActiveRecord::Base>, #connection_pool, #transaction] an `ActiveRecord::Base` subclass
+ # @param destination_class [Class<ActiveRecord::Base>, #connection_pool, #transaction] an `ActiveRecord::Base`
+ # subclass.
# @yield Block run database transaction
# @yieldreturn [Object] value to return
# @return [Object] value returned from `block`
| Fix parameter name in yard docs
MSP-12441
|
diff --git a/singleplatform.gemspec b/singleplatform.gemspec
index abc1234..def5678 100644
--- a/singleplatform.gemspec
+++ b/singleplatform.gemspec
@@ -1,7 +1,7 @@ # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
-require 'singleplatform/version'
+require "singleplatform/version"
Gem::Specification.new do |spec|
spec.name = "singleplatform"
@@ -19,6 +19,8 @@
spec.add_development_dependency "bundler", "~> 1.12"
spec.add_development_dependency "rake", "~> 10.0"
-
+ spec.add_development_dependency "rspec", "~> 2.99.0"
+ spec.add_development_dependency "webmock", "~> 2.1.0"
+ spec.add_runtime_dependency "hashie"
spec.add_runtime_dependency "httparty"
end
| Add runtime and development dependencies
|
diff --git a/lib/roo_on_rails/railties/http.rb b/lib/roo_on_rails/railties/http.rb
index abc1234..def5678 100644
--- a/lib/roo_on_rails/railties/http.rb
+++ b/lib/roo_on_rails/railties/http.rb
@@ -31,7 +31,7 @@ # Don't use SslEnforcer in test environment as it breaks Capybara
unless Rails.env.test?
app.config.middleware.insert_before(
- ActionDispatch::Cookies,
+ Rack::Head,
::Rack::SslEnforcer
)
end
| Change the middleware we inserted before
|
diff --git a/lib/tasks/spree_multi_tenant.rake b/lib/tasks/spree_multi_tenant.rake
index abc1234..def5678 100644
--- a/lib/tasks/spree_multi_tenant.rake
+++ b/lib/tasks/spree_multi_tenant.rake
@@ -11,7 +11,10 @@ exit
end
- tenant = Spree::Tenant.create!({:domain => domain.dup, :code => code.dup})
+ tenant = Spree::Tenant.create! do |t|
+ t.domain = domain.dup
+ t.code = code.dup
+ end
tenant.create_template_and_assets_paths
end
| Use block for multi-assignment protection
|
diff --git a/lib/tasks/worldwide_taxonomy.rake b/lib/tasks/worldwide_taxonomy.rake
index abc1234..def5678 100644
--- a/lib/tasks/worldwide_taxonomy.rake
+++ b/lib/tasks/worldwide_taxonomy.rake
@@ -0,0 +1,22 @@+namespace :worldwide_taxonomy do
+ task redirect_world_location_translations_to_en: :environment do
+ base_path_prefix = "/government/world"
+ world_locations = WorldLocation.all
+
+ world_locations.each do |world_location|
+ en_slug = world_location.slug
+ destination_base_path = File.join("", base_path_prefix, en_slug)
+ content_id = world_location.content_id
+ locales = world_location.original_available_locales - [:en]
+
+ locales.each do |locale|
+ PublishingApiRedirectWorker.perform_async_in_queue(
+ "bulk_republishing",
+ content_id,
+ destination_base_path,
+ locale
+ )
+ end
+ end
+ end
+end
| Add rake tasks for redirecting WorldLocations
Redirect all the WorldLocation translations. They are no longer supported so are
redirected to the non-translated taxon page. This will also cause them
to appear unpublished to the publishing API which will remove them from
the links of other content.
|
diff --git a/lib/vagrant/util/file_checksum.rb b/lib/vagrant/util/file_checksum.rb
index abc1234..def5678 100644
--- a/lib/vagrant/util/file_checksum.rb
+++ b/lib/vagrant/util/file_checksum.rb
@@ -26,7 +26,7 @@ def checksum
digest = @digest_klass.new
- File.open(@path, "r") do |f|
+ File.open(@path, "rb") do |f|
while !f.eof
begin
buf = f.readpartial(BUFFER_SIZE)
| Read box file in binary mode for checksum |
diff --git a/app/controllers/event_streams_controller.rb b/app/controllers/event_streams_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/event_streams_controller.rb
+++ b/app/controllers/event_streams_controller.rb
@@ -5,6 +5,6 @@ end
def ids
- Journal.joins(:papers => :user).where('users.id = ?', current_user.id).uniq.pluck(:id)
+ Journal.joins(papers: :user).where('users.id = ?', current_user.id).uniq.pluck(:id)
end
end
| Update to ruby 2.0 syntax
|
diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb
index abc1234..def5678 100644
--- a/config/initializers/cookies_serializer.rb
+++ b/config/initializers/cookies_serializer.rb
@@ -2,4 +2,4 @@
# Specify a serializer for the signed and encrypted cookie jars.
# Valid options are :json, :marshal, and :hybrid.
-Rails.application.config.action_dispatch.cookies_serializer = :hybrid
+Rails.application.config.action_dispatch.cookies_serializer = :json
| Use JSON instead of Hybrid to serialize cookies
|
diff --git a/lib/pakyow/console/editors/relation_editor.rb b/lib/pakyow/console/editors/relation_editor.rb
index abc1234..def5678 100644
--- a/lib/pakyow/console/editors/relation_editor.rb
+++ b/lib/pakyow/console/editors/relation_editor.rb
@@ -3,11 +3,13 @@ editor = view.scope(:editor)[0]
editor.scoped_as = :datum
- if attribute[:name] == datum_type.name
+ view.component(:modal).with do |view|
# disallow self-referential relationships
- view.component(:modal).remove
- else
- view.component(:modal).attrs.href = router.group(:data).path(:show, data_id: attribute[:name])
+ if attribute[:name] == datum_type.name
+ view.remove
+ else
+ view.attrs.href = router.group(:data).path(:show, data_id: attribute[:name])
+ end
end
related_class = attribute[:extras][:class]
| Refactor relation editor view logic
Turns out that accepting the view as an argument to `with` allows the
block to be evaluated in the current context such that global helpers
like `router` are available.
|
diff --git a/add_values.rb b/add_values.rb
index abc1234..def5678 100644
--- a/add_values.rb
+++ b/add_values.rb
@@ -0,0 +1,11 @@+require 'csv'
+Pathname.glob('validation_results/**/*.csv').each do |file|
+ contents = CSV.read(file, headers: true, return_headers: true)
+ headers = contents.select{|r| r.header_row?}.first
+ next if contents.length == 0
+ CSV.open(file, 'w') do |csv|
+ csv << (headers << :value_as_numeric << :value_as_string << :value_as_concept_id)
+ contents.select{|r| !r.header_row?}.each { |c| csv << (c << nil << nil << nil) }
+ end
+end
+
| Add script that added value columns
|
diff --git a/app/views/notifications/index.json.jbuilder b/app/views/notifications/index.json.jbuilder
index abc1234..def5678 100644
--- a/app/views/notifications/index.json.jbuilder
+++ b/app/views/notifications/index.json.jbuilder
@@ -30,6 +30,7 @@ json.title notification.subject_title
json.url notification.subject_url
json.type notification.subject_type
+ json.state notification.state
end
json.repo do
| Add notification state to the JSON output
|
diff --git a/spec/frontable_spec.rb b/spec/frontable_spec.rb
index abc1234..def5678 100644
--- a/spec/frontable_spec.rb
+++ b/spec/frontable_spec.rb
@@ -4,15 +4,32 @@ include Dimples::Frontable
describe '#read_with_front_matter' do
- let(:source_path) do
- File.join(__dir__, 'sources', 'pages', 'about', 'index.markdown')
+ context 'with a file containing frontmatter' do
+ let(:source_path) do
+ File.join(__dir__, 'sources', 'pages', 'about', 'index.markdown')
+ end
+
+ it 'correctly parses the contents and metadata' do
+ contents, metadata = read_with_front_matter(source_path)
+
+ expect(contents).to eq('I am a test website.')
+ expect(metadata).to eq(title: 'About', layout: 'default')
+ end
end
- it 'correctly parses the contents and metadata' do
- contents, metadata = read_with_front_matter(source_path)
+ context 'with a file containing no frontmatter' do
+ let(:source_path) do
+ File.join(__dir__, 'sources', 'templates', 'default.erb')
+ end
- expect(contents).to eq('I am a test website.')
- expect(metadata).to eq(title: 'About', layout: 'default')
+ let(:raw_content) { File.read(source_path) }
+
+ it 'reads in just the contents' do
+ contents, metadata = read_with_front_matter(source_path)
+
+ expect(contents).to eq(raw_content)
+ expect(metadata).to eq({})
+ end
end
end
end
| Add a frontable test for files without metadata
|
diff --git a/spec/lib/hours_spec.rb b/spec/lib/hours_spec.rb
index abc1234..def5678 100644
--- a/spec/lib/hours_spec.rb
+++ b/spec/lib/hours_spec.rb
@@ -9,7 +9,7 @@ it "raises an error when the account or url is empty" do
allow(Hours).to receive(:helpful_account).and_return ""
allow(Hours).to receive(:helpful_url).and_return ""
- expect { Hours.helpful_enabled? }. to raise_error
+ expect { Hours.helpful_enabled? }. to raise_error(RuntimeError)
end
it "returns true when account and url are set" do
| Fix using bare raise_error matcher
This is due to receiving a deprecation warning:
```sh
WARNING: Using the `raise_error` matcher without providing a specific error or message risks false positives, since `raise_error` will match
-- snip --
```
|
diff --git a/lib/cw/config_file.rb b/lib/cw/config_file.rb
index abc1234..def5678 100644
--- a/lib/cw/config_file.rb
+++ b/lib/cw/config_file.rb
@@ -1,7 +1,7 @@ class ConfigFile
CONFIG = ".cw_config"
- CONFIGS = ['wpm']
+ CONFIGS = ['wpm', 'book_name']
HERE = File.dirname(__FILE__) + '/'
attr_reader :config
| Add config file book_name option
|
diff --git a/lib/dotter/package.rb b/lib/dotter/package.rb
index abc1234..def5678 100644
--- a/lib/dotter/package.rb
+++ b/lib/dotter/package.rb
@@ -8,30 +8,39 @@ @name = name
@config = Configuration.new
@our_config = @config.package_config(@name)
+ if self.tracked?
+ @repo = GitRepo.new(name)
+ end
end
- def stow()
+ def stow
go_to_dotfiles
returned_output = `stow -v #{@name}`
@config.set_state(@name, 'stowed')
returned_output
end
- def unstow()
+ def unstow
go_to_dotfiles
returned_output = `stow -Dv #{@name}`
@config.set_state(@name, 'unstowed')
returned_output
end
- def track()
+ def track
@repo = GitRepo.new(@name,true)
@config.track(@name)
end
- def stowed?()
+ def stowed?
@our_config['state'] == 'stowed'
end
- def unstowed?()
+ def unstowed?
!self.stowed?
end
- def to_s()
+ def tracked?
+ @our_config['tracked']
+ end
+ def untracked?
+ !self.tracked?
+ end
+ def to_s
@name
end
attr_reader :name
| Clean up parens and add 2 tracking-related boolean methods.
|
diff --git a/lib/skeptic/critic.rb b/lib/skeptic/critic.rb
index abc1234..def5678 100644
--- a/lib/skeptic/critic.rb
+++ b/lib/skeptic/critic.rb
@@ -16,53 +16,21 @@ @tokens = Ripper.lex(code)
@sexp = Ripper.sexp(code)
- look_for_semicolons
- analyze_nesting
- analyze_method_count
- analyze_method_length
- end
+ rules = {
+ SemicolonDetector => complain_about_semicolons,
+ NestingAnalyzer => max_nesting,
+ MethodCounter => methods_per_class,
+ MethodSizeAnalyzer => method_length,
+ }
- private
+ rules.reject { |rule, option| option.nil? }.each do |rule, option|
+ analyzer = rule.new(option)
+ analyzer.analyze_sexp @sexp if analyzer.respond_to? :analyze_sexp
+ analyzer.analyze_tokens @tokens if analyzer.respond_to? :analyze_tokens
- def add_criticism(message, type)
- @criticism << [message, type]
- end
-
- def look_for_semicolons
- analyzer = SemicolonDetector.new(complain_about_semicolons).analyze_tokens(@tokens)
-
- analyzer.violations.each do |violation|
- add_criticism violation, analyzer.rule_name
- end
- end
-
- def analyze_nesting
- return if max_nesting.nil?
-
- analyzer = NestingAnalyzer.new(max_nesting).analyze_sexp(@sexp)
-
- analyzer.violations.each do |violation|
- add_criticism violation, analyzer.rule_name
- end
- end
-
- def analyze_method_count
- return if methods_per_class.nil?
-
- analyzer = MethodCounter.new(methods_per_class).analyze_sexp(@sexp)
-
- analyzer.violations.each do |violation|
- add_criticism violation, analyzer.rule_name
- end
- end
-
- def analyze_method_length
- return if method_length.nil?
-
- analyzer = MethodSizeAnalyzer.new(method_length).analyze_sexp(@sexp)
-
- analyzer.violations.each do |violation|
- add_criticism violation, analyzer.rule_name
+ analyzer.violations.each do |violation|
+ @criticism << [violation, analyzer.rule_name]
+ end
end
end
end
| Reduce a bunch of repetition in Critic
|
diff --git a/omniauth-beatport.gemspec b/omniauth-beatport.gemspec
index abc1234..def5678 100644
--- a/omniauth-beatport.gemspec
+++ b/omniauth-beatport.gemspec
@@ -21,6 +21,5 @@ s.add_development_dependency 'rack-test'
s.add_development_dependency 'simplecov'
s.add_development_dependency 'webmock'
-
-
+ s.add_development_dependency 'gem-release'
end
| Add gem-release gem to dev dependencies
|
diff --git a/robot_name/robot_name.rb b/robot_name/robot_name.rb
index abc1234..def5678 100644
--- a/robot_name/robot_name.rb
+++ b/robot_name/robot_name.rb
@@ -22,10 +22,10 @@ end
def generate_name
- name = ''
- 2.times { name << ('A'..'Z').to_a.sample }
- 3.times { name << rand(10).to_s }
- name
+ temp_name = ''
+ 2.times { temp_name << ('A'..'Z').to_a.sample }
+ 3.times { temp_name << rand(10).to_s }
+ temp_name
end
def check_name_format
| Change temp variable from name to temp_name
I realized that 'name' is a method of this class, so it wasn't a
good temporary variable name in the generate_name method.
Eventually, I need to find a way to not use the temp variable at
all.
|
diff --git a/lib/accela/api/v4/base.rb b/lib/accela/api/v4/base.rb
index abc1234..def5678 100644
--- a/lib/accela/api/v4/base.rb
+++ b/lib/accela/api/v4/base.rb
@@ -44,8 +44,6 @@ if is_success?(response)
response.parsed_response
else
- puts response.request.inspect
- puts response.headers.inspect
ErrorHandler.handle(response)
end
end
| Remove 'puts' logging when a request fails
|
diff --git a/lib/ap/core_ext/string.rb b/lib/ap/core_ext/string.rb
index abc1234..def5678 100644
--- a/lib/ap/core_ext/string.rb
+++ b/lib/ap/core_ext/string.rb
@@ -11,7 +11,7 @@ define_method :"#{color}ish" do "\033[0;#{30+i}m#{self}\033[0m" end
else
define_method color do self end
- alias_method :"#{color}ish", color # <- This break Rdoc: Name or symbol expected (got #<RubyToken::TkDSTRING
+ alias_method :"#{color}ish", color
end
end
| Remove rdoc comment, as the parser should no longer complain on that line.
|
diff --git a/spec/controllers/welcome_controller_spec.rb b/spec/controllers/welcome_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/welcome_controller_spec.rb
+++ b/spec/controllers/welcome_controller_spec.rb
@@ -1,6 +1,7 @@ require 'spec_helper'
-describe WelcomeController do
+
+describe "WelcomeController" do
describe "GET 'index'" do
it "returns http success" do
| Fix for specs to run correctly.
Test for WelcomeController should fail not crash.
|
diff --git a/spec/ruby/core/enumerator/lazy/lazy_spec.rb b/spec/ruby/core/enumerator/lazy/lazy_spec.rb
index abc1234..def5678 100644
--- a/spec/ruby/core/enumerator/lazy/lazy_spec.rb
+++ b/spec/ruby/core/enumerator/lazy/lazy_spec.rb
@@ -0,0 +1,11 @@+# -*- encoding: us-ascii -*-
+
+require File.expand_path('../../../../spec_helper', __FILE__)
+
+ruby_version_is "2.0" do
+ describe "Enumerator::Lazy" do
+ it "is a subclass of Enumerator" do
+ enumerator_class::Lazy.superclass.should equal(enumerator_class)
+ end
+ end
+end
| Write a spec for Enumerator::Lazy
|
diff --git a/lib/chef_metal_vagrant.rb b/lib/chef_metal_vagrant.rb
index abc1234..def5678 100644
--- a/lib/chef_metal_vagrant.rb
+++ b/lib/chef_metal_vagrant.rb
@@ -19,13 +19,15 @@ end
class Chef
- class Recipe
- def with_vagrant_cluster(cluster_path, &block)
- with_provisioner(ChefMetalVagrant::VagrantProvisioner.new(cluster_path), &block)
- end
+ module DSL
+ module Recipe
+ def with_vagrant_cluster(cluster_path, &block)
+ with_provisioner(ChefMetalVagrant::VagrantProvisioner.new(cluster_path), &block)
+ end
- def with_vagrant_box(box_name, vagrant_options = {}, &block)
- ChefMetalVagrant.with_vagrant_box(run_context, box_name, vagrant_options, &block)
+ def with_vagrant_box(box_name, vagrant_options = {}, &block)
+ ChefMetalVagrant.with_vagrant_box(run_context, box_name, vagrant_options, &block)
+ end
end
end
end
| Move recipe DSL into Chef::DSL::Recipe
|
diff --git a/lib/docs/scrapers/node.rb b/lib/docs/scrapers/node.rb
index abc1234..def5678 100644
--- a/lib/docs/scrapers/node.rb
+++ b/lib/docs/scrapers/node.rb
@@ -23,12 +23,12 @@ HTML
version do
- self.release = '6.3.1'
+ self.release = '6.4.0'
self.base_url = 'https://nodejs.org/api/'
end
version '4 LTS' do
- self.release = '4.4.7'
+ self.release = '4.5.0'
self.base_url = "https://nodejs.org/dist/v#{release}/docs/api/"
end
end
| Update Node.js documentation (6.4.0, 4.5.0)
|
diff --git a/lib/rollbar/active_job.rb b/lib/rollbar/active_job.rb
index abc1234..def5678 100644
--- a/lib/rollbar/active_job.rb
+++ b/lib/rollbar/active_job.rb
@@ -3,7 +3,7 @@ module ActiveJob
def self.included(base)
base.send :rescue_from, Exception do |exception|
- Rollbar.error(exception, job: self.class.name, job_id: job_id)
+ Rollbar.error(exception, :job => self.class.name, :job_id => job_id)
end
end
end
| Use old hash syntax for old Rubies
|
diff --git a/spec/models/image_spec.rb b/spec/models/image_spec.rb
index abc1234..def5678 100644
--- a/spec/models/image_spec.rb
+++ b/spec/models/image_spec.rb
@@ -8,6 +8,8 @@
it 'will have a key' do
image = Image.create! valid_attributes
- image.key should exist
+
+ Image.all.should have(1).item
+ Image.first.key.should exist
end
end
| Check if image saved and a key exists
|
diff --git a/spec/rails_reseed_spec.rb b/spec/rails_reseed_spec.rb
index abc1234..def5678 100644
--- a/spec/rails_reseed_spec.rb
+++ b/spec/rails_reseed_spec.rb
@@ -13,4 +13,8 @@ ['db:drop', 'db:create', 'db:migrate', 'db:seed']
)
end
+
+ it 'outputs a message to indicate successful completion' do
+ expect { subject.execute }.to output("Reseeding completed.\n").to_stdout
+ end
end
| Add spec to test message output
|
diff --git a/lib/stripe/file_upload.rb b/lib/stripe/file_upload.rb
index abc1234..def5678 100644
--- a/lib/stripe/file_upload.rb
+++ b/lib/stripe/file_upload.rb
@@ -1,5 +1,3 @@-require "tempfile"
-
module Stripe
class FileUpload < APIResource
extend Stripe::APIOperations::Create
@@ -20,9 +18,9 @@
def self.create(params = {}, opts = {})
# rest-client would accept a vanilla `File` for upload, but Faraday does
- # not. Support the old API by wrapping a `File` with an `UploadIO` object
- # if we're given one.
- if params[:file] && [File, Tempfile].any? { |klass| params[:file].is_a?(klass) }
+ # not. Support the old API by wrapping a `File`-like object with an
+ # `UploadIO` object if we're given one.
+ if params[:file] && params[:file].respond_to?(:path) && params[:file].respond_to?(:read)
params[:file] = Faraday::UploadIO.new(params[:file], nil)
end
| Use duck typing to detect File-like objects
|
diff --git a/lib/supermarket/import.rb b/lib/supermarket/import.rb
index abc1234..def5678 100644
--- a/lib/supermarket/import.rb
+++ b/lib/supermarket/import.rb
@@ -37,7 +37,12 @@
debug do
message_header = "#{e.class}: #{e.message}\n #{raven_options.inspect}"
- message_body = ([message_header] + e.backtrace).join("\n ")
+
+ relevant_backtrace = e.backtrace.select do |line|
+ line.include?('supermarket') || line.include?('chef-legacy')
+ end
+
+ message_body = ([message_header] + relevant_backtrace).join("\n ")
yield message_body
end
| Debug messages show scrubbed backtraces
|
diff --git a/lib/sync_issues/github.rb b/lib/sync_issues/github.rb
index abc1234..def5678 100644
--- a/lib/sync_issues/github.rb
+++ b/lib/sync_issues/github.rb
@@ -34,7 +34,9 @@ def token
path = File.expand_path('~/.config/sync_issues.yaml')
raise TokenError, "#{path} does not exist" unless File.exist?(path)
- SafeYAML.load(File.read(path))['token']
+ SafeYAML.load(File.read(path))['token'].tap do |token|
+ raise TokenError, "#{path} missing token attribute" if token.nil?
+ end
end
end
end
| Verify that the yaml config contains a token attribute.
|
diff --git a/autoprefixer-rails.gemspec b/autoprefixer-rails.gemspec
index abc1234..def5678 100644
--- a/autoprefixer-rails.gemspec
+++ b/autoprefixer-rails.gemspec
@@ -10,7 +10,7 @@
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {spec}/*`.split("\n")
- s.extra_rdoc_files = ['README.md', 'LICENSE', 'ChangeLog']
+ s.extra_rdoc_files = ['README.md', 'LICENSE', 'ChangeLog.md']
s.require_path = 'lib'
s.author = 'Andrey "A.I." Sitnik'
| Fix gemspec for Markdown in Changelog
|
diff --git a/sg_node_mapper.gemspec b/sg_node_mapper.gemspec
index abc1234..def5678 100644
--- a/sg_node_mapper.gemspec
+++ b/sg_node_mapper.gemspec
@@ -17,4 +17,6 @@
gem.add_dependency 'execjs', '>= 1.4'
gem.add_dependency 'activesupport', '>= 3.0'
+
+ gem.add_development_dependency 'rake', '>= 0.9'
end
| Add rake as a development dependency
|
diff --git a/app/serializers/api/admin/for_order_cycle/enterprise_serializer.rb b/app/serializers/api/admin/for_order_cycle/enterprise_serializer.rb
index abc1234..def5678 100644
--- a/app/serializers/api/admin/for_order_cycle/enterprise_serializer.rb
+++ b/app/serializers/api/admin/for_order_cycle/enterprise_serializer.rb
@@ -34,11 +34,11 @@ private
def products_scope
+ products_relation = object.supplied_products
if order_cycle.prefers_product_selection_from_coordinator_inventory_only?
- object.supplied_products.visible_for(order_cycle.coordinator)
- else
- object.supplied_products
+ products_relation = products_relation.visible_for(order_cycle.coordinator)
end
+ products_relation
end
def products
| Refactor products_scope to make it more simple
|
diff --git a/gitra.gemspec b/gitra.gemspec
index abc1234..def5678 100644
--- a/gitra.gemspec
+++ b/gitra.gemspec
@@ -5,7 +5,7 @@ gem.name = 'gitra'
gem.version = "#{Gitra::VERSION}.dev"
- gem.summary = "Git Route Analyzer"
+ gem.summary = "Git Repository Analyzer"
gem.description = "Analyze branches and continuity in a git repository."
gem.authors = ['David Lantos']
gem.email = ['david.lantos@gmail.com']
| Update project name in gemspec.
Since I started using "repository", I will use that everywhere.
|
diff --git a/spec/acceptance/joining_and_leaving_spec.rb b/spec/acceptance/joining_and_leaving_spec.rb
index abc1234..def5678 100644
--- a/spec/acceptance/joining_and_leaving_spec.rb
+++ b/spec/acceptance/joining_and_leaving_spec.rb
@@ -0,0 +1,21 @@+require File.expand_path(File.dirname(__FILE__) + '/acceptance_helper')
+
+feature "A user with a linked person should be join and leave things:" do
+ [:group, :project, :company].each do |thing|
+ scenario "They should be able to join and leave #{thing.to_s.pluralize}" do
+ @thing = Factory(thing)
+ signed_in_as(:user_with_person) do
+ visit url_for(@thing)
+ page.should have_selector "a.join"
+
+ click_link("Join this #{thing}")
+ page.find('.section.members').should have_content @user.person.name
+ page.should have_selector "a.leave"
+
+ click_link("Leave this #{thing}")
+ page.find('.section.members').should_not have_content @user.person.name
+ page.should have_selector "a.join"
+ end
+ end
+ end
+end
| Add acceptance tests for joining and leaving groups, projects, and companies. |
diff --git a/spec/defines/recovery_message_spec.rb b/spec/defines/recovery_message_spec.rb
index abc1234..def5678 100644
--- a/spec/defines/recovery_message_spec.rb
+++ b/spec/defines/recovery_message_spec.rb
@@ -11,4 +11,15 @@ :value => title
)}
end
+
+ context 'with ensure => absent' do
+ let(:title) { 'foo' }
+ let(:params) { {:ensure => 'absent'} }
+
+ it { should contain_property_list_key('Remove OS X Recovery Message').with(
+ :ensure => 'absent',
+ :path => '/Library/Preferences/com.apple.loginwindow.plist',
+ :key => 'LoginwindowText',
+ )}
+ end
end
| Add spec for removing the message
|
diff --git a/spec/pivotal_tracker/iteration_spec.rb b/spec/pivotal_tracker/iteration_spec.rb
index abc1234..def5678 100644
--- a/spec/pivotal_tracker/iteration_spec.rb
+++ b/spec/pivotal_tracker/iteration_spec.rb
@@ -5,15 +5,22 @@ @pivotal = PivotalTracker(:token => 'foo')
@project = PivotalTracker::Project.new(:id => 1)
@iteration = PivotalTracker::Iteration.new(:id => 1)
+ @iteration.project = @project
end
it "should set the project" do
+ @project.id = 2
@iteration.project = @project
- @iteration.prefix_options[:project_id].should == 1
+ @iteration.prefix_options[:project_id].should == 2
end
it "should get the project" do
- @iteration.project = @project
@iteration.project.should be_kind_of(PivotalTracker::Project)
end
+
+ it "should get the stories" do
+ iteration = @project.current
+ iteration.stories.should be_kind_of(Array)
+ iteration.stories.count.should == 19
+ end
end
| Add stories feature to iteration
|
diff --git a/spec/support/generator_spec_support.rb b/spec/support/generator_spec_support.rb
index abc1234..def5678 100644
--- a/spec/support/generator_spec_support.rb
+++ b/spec/support/generator_spec_support.rb
@@ -1,7 +1,7 @@ module GeneratorSpecSupport
def assert_expectation_file(path, expectation_filepath = nil)
- expectation_filepath ||= File.expand_path("../../generators/expectations/#{path}", __FILE__)
+ expectation_filepath ||= File.expand_path("../../../examples/#{path}", __FILE__)
expectation_filepath.sub!(/_spec\.rb\z/, '_spek.rb')
assert_file(path, File.read(expectation_filepath))
end
| Use examples instead of spec/generators/expectations
|
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
@@ -1,3 +1,6 @@+require 'simplecov'
+SimpleCov.start
+
ENV["RAILS_ENV"] ||= "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
| Add simple cov on test startup
|
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
@@ -1,4 +1,5 @@ # frozen_string_literal: true
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
# load Rails first
@@ -7,13 +8,29 @@ # load the plugin
require 'active_decorator'
+Bundler.require
+require 'capybara'
+require 'selenium/webdriver'
+
# needs to load the app next
require 'fake_app/fake_app'
require 'test/unit/rails/test_help'
-class ActionDispatch::IntegrationTest
- include Capybara::DSL
+begin
+ require 'action_dispatch/system_test_case'
+rescue LoadError
+ Capybara.register_driver :chrome do |app|
+ options = Selenium::WebDriver::Chrome::Options.new(args: %w[no-sandbox headless disable-gpu])
+ Capybara::Selenium::Driver.new(app, browser: :chrome, options: options)
+ end
+ Capybara.javascript_driver = :chrome
+
+ class ActionDispatch::IntegrationTest
+ include Capybara::DSL
+ end
+else
+ ActionDispatch::SystemTestCase.driven_by(:selenium, using: :headless_chrome)
end
module DatabaseDeleter
| Use AD::SystemTestCase on Rails 5.2+
|
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
@@ -1,7 +1,5 @@-if ENV['TRAVIS']
- require 'coveralls'
- Coveralls.wear!
-end
+require 'coveralls'
+Coveralls.wear_merged!('rails')
ENV["RAILS_ENV"] ||= "test"
require File.expand_path('../../config/environment', __FILE__)
| Fix unit test coveralls to run outside travis
|
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
@@ -1,5 +1,3 @@-$:.unshift File.dirname(__FILE__) + '/../lib'
-require 'rubygems'
require 'simplecov'
SimpleCov.start
require 'twurl'
| Remove unnecessary and require 'rubygems'
|
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
@@ -1,5 +1,6 @@ require "minitest/autorun"
require "timecop"
+require "pathname"
root = Pathname(__FILE__).dirname.expand_path
Dir[root.join("support", "**", "*.rb")].each { |f| require f }
| Add missing require for pathname in test helper
|
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
@@ -33,10 +33,6 @@ File.join(root, path)
end
- def template_root
- File.expand_path('../templates', __FILE__)
- end
-
def touch(path)
pathed = fs(path)
FileUtils.touch(pathed)
| Remove unused test helper method.
|
diff --git a/spec/simplecov_uncovered_formatter.rb b/spec/simplecov_uncovered_formatter.rb
index abc1234..def5678 100644
--- a/spec/simplecov_uncovered_formatter.rb
+++ b/spec/simplecov_uncovered_formatter.rb
@@ -7,11 +7,13 @@ result.groups.each_value do |files|
files.each do |file|
next if file.covered_percent == 100
+ next if file.covered_percent == 0
output << "#{file.filename} (coverage: #{file.covered_percent.round(2)}%)\n"
+ output << "#{file.missed_lines.map(&:line_number).join(', ')}\n"
end
end
# Only show this terminal output if there are no more than 20 files lacking
# coverage. That way it won't annoy for partial spec runs.
- puts output unless output.count > 20
+ puts output unless output.count > 40
end
end
| Add line numbers to SimplecovUncoveredFormatter
This will make it easier to see exactly which code lacks coverage.
|
diff --git a/spec/models/transaction_spec.rb b/spec/models/transaction_spec.rb
index abc1234..def5678 100644
--- a/spec/models/transaction_spec.rb
+++ b/spec/models/transaction_spec.rb
@@ -0,0 +1,11 @@+require 'rails_helper'
+
+describe Transaction do
+ context "validations" do
+ it { should validate_inclusion_of(:transaction_type).in_array(%w(request response fulfillment)) }
+ end
+
+ context "associations" do
+ it { should belong_to :request }
+ end
+end
| Add basic test suite for Transactions.
At the moment, this test suite only covers associations and validations,
for a 64% test coverage. More test will be forthcoming.
|
diff --git a/spec/swt_shoes/progress_spec.rb b/spec/swt_shoes/progress_spec.rb
index abc1234..def5678 100644
--- a/spec/swt_shoes/progress_spec.rb
+++ b/spec/swt_shoes/progress_spec.rb
@@ -4,7 +4,7 @@ let(:text) { "TEXT" }
let(:dsl) { double('dsl').as_null_object }
let(:parent) { double('parent') }
- let(:real) { double('real').as_null_object }
+ let(:real) { double('real', :disposed? => false).as_null_object }
subject { Shoes::Swt::Progress.new dsl, parent }
| Fix tests by adding disposed? => false to real stub in progress bar test
|
diff --git a/spec/watirspec/lib/watirspec.rb b/spec/watirspec/lib/watirspec.rb
index abc1234..def5678 100644
--- a/spec/watirspec/lib/watirspec.rb
+++ b/spec/watirspec/lib/watirspec.rb
@@ -1,6 +1,6 @@ module WatirSpec
class << self
- attr_accessor :browser_args, :persistent_browser, :unguarded
+ attr_accessor :browser_args, :persistent_browser, :unguarded, :implementation
def html
File.expand_path("#{File.dirname(__FILE__)}/../html")
| Add ability to set impl name manually using WatirSpec.implementation=
|
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,6 @@ class ApplicationController < ActionController::Base
protect_from_forgery
+ rescue_from ActionController::RoutingError, with: :not_found
before_action :set_locale
@@ -37,4 +38,8 @@ options.update(locale: I18n.locale)
options
end
+
+ def not_found
+ render plain: "404 Not Found", status: 404
+ end
end
| Add a 404 not found error message so the logs are more clean
|
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
@@ -24,9 +24,10 @@ token = Integer(subclass.token)
digits = Integer(shelfmark.match(/(\d+)/)[0])
- digitsLength = Integer((Math.log10(digits)+1))
+ digits = digits.to_s.rjust(4, "0") # add prepending 0s
- return token + Float(digits)/Float((10 ** digitsLength))
+ res = Float(token.to_s + '.' + digits)
+ return res;
end
end
| Fix shelfmark floating number order issue
|
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
@@ -12,10 +12,15 @@ private
def authenticate
- token = request.headers['authorization'].gsub('Bearer ', '')
- @current_user = User.find_by(token: token)
- fail if @current_user.blank?
- rescue
- head :unauthorized
+ @current_user = User.find_by(token: request_token)
+ fail "Invalid Token" if @current_user.blank?
+ rescue => e
+ render json: { error: e.message }, status: :unauthorized
+ end
+
+ def request_token
+ authorization_header = request.headers["Authorization"]
+ fail "Missing Authorization Header" if authorization_header.blank?
+ authorization_header.gsub("Bearer ", "")
end
end
| Check if authorization header is missing
|
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,7 +11,7 @@ end
def set_university
- @university = Organization.root
+ @university = Organization.root || Factory.build(:organization)
end
end
| Fix index not to break if there are no root organizations |
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,3 +1,17 @@ class ApplicationController < ActionController::Base
protect_from_forgery
+ before_filter :authenticate_user_from_http_basic!
+
+ def authenticate_user_from_http_basic!
+ if (request.authorization)
+ authorization = ActionController::HttpAuthentication::Basic.user_name_and_password(request)
+ email = authorization[0]
+ password = authorization[1]
+ end
+
+ user = User.find_for_authentication email: email
+ if user && user.valid_password?(password)
+ sign_in user, store: false
+ end
+ end
end
| Allow authentication using HTTP basic
|
diff --git a/app/controllers/restaurants_controller.rb b/app/controllers/restaurants_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/restaurants_controller.rb
+++ b/app/controllers/restaurants_controller.rb
@@ -10,5 +10,11 @@ def create
end
+ def update
+ end
+
+ def destroy
+ end
+
end
| Create skeleton for restaurants controller
|
diff --git a/httpi.gemspec b/httpi.gemspec
index abc1234..def5678 100644
--- a/httpi.gemspec
+++ b/httpi.gemspec
@@ -8,7 +8,7 @@ s.version = HTTPI::VERSION
s.authors = ['Daniel Harrington', 'Martin Tepper']
s.email = 'me@rubiii.com'
- s.homepage = "http://github.com/savonrb/#{s.name}"
+ s.homepage = "https://github.com/savonrb/httpi"
s.summary = "Common interface for Ruby's HTTP libraries"
s.description = s.summary
| Use HTTPS for "homepage" in gemspec [ci skip]
Also, use a literal string without interpolations, for legibility. |
diff --git a/spec/unit/mongoid/extensions/symbol/inflections_spec.rb b/spec/unit/mongoid/extensions/symbol/inflections_spec.rb
index abc1234..def5678 100644
--- a/spec/unit/mongoid/extensions/symbol/inflections_spec.rb
+++ b/spec/unit/mongoid/extensions/symbol/inflections_spec.rb
@@ -50,6 +50,15 @@ ret.operator.should == "near"
end
end
+
+ describe "#not" do
+
+ it 'returns :"foo not"' do
+ ret = :foo.not
+ ret.key.should == :foo
+ ret.operator.should == "not"
+ end
+ end
describe "#within" do
| Add spec case for $not in symbol inflections. |
diff --git a/app/controllers/spree/api/braintree_client_token_controller.rb b/app/controllers/spree/api/braintree_client_token_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/spree/api/braintree_client_token_controller.rb
+++ b/app/controllers/spree/api/braintree_client_token_controller.rb
@@ -1,7 +1,7 @@ class Spree::Api::BraintreeClientTokenController < Spree::Api::BaseController
def create
if params[:payment_method_id]
- gateway = Solidus::Gateway::BraintreeGateway.find!(params[:payment_method_id])
+ gateway = Solidus::Gateway::BraintreeGateway.find_by!(id: params[:payment_method_id])
else
gateway = Solidus::Gateway::BraintreeGateway.find_by!(active: true, environment: Rails.env)
end
| Throw exception if Gateway is not found
|
diff --git a/spec/features/pm_spec.rb b/spec/features/pm_spec.rb
index abc1234..def5678 100644
--- a/spec/features/pm_spec.rb
+++ b/spec/features/pm_spec.rb
@@ -0,0 +1,33 @@+require 'rails_helper'
+
+describe 'the private messaging system', type: feature do
+
+ before(:each) do
+ FactoryGirl.create(:ip_cache, ip_address: '1.2.3.4')
+ end
+
+ let(:sender) do
+ FactoryGirl.create(:activated_user, email: 'sender@example.com')
+ end
+
+# let(:recipient) do
+# FactoryGirl.create(:activated_user, email: 'recipient@example.com')
+# end
+
+ it 'disallows a user from sending themselves a private message' do
+ visit '/login'
+ fill_in 'E-mail', with: 'sender@example.com'
+ fill_in 'Password', with: 'password'
+ click_button 'Log In'
+ expect(current_path).to eq '/'
+ expect(page).to have_content 'sender@example.com'
+ click_link 'New Topic'
+ fill_in 'Title', with: 'Inspiring topic title'
+ fill_in 'Message', with: 'Bold and motivational message body'
+ click_button 'Post'
+ expect(current_path).to eq '/topics/1'
+ click_link 'Contact'
+ expect(current_path).to eq '/topics/1'
+ expect(page).to have_css 'alert'
+ end
+end
| Initialize PM topics rspec test
|
diff --git a/activerecord-postgresql-extensions.gemspec b/activerecord-postgresql-extensions.gemspec
index abc1234..def5678 100644
--- a/activerecord-postgresql-extensions.gemspec
+++ b/activerecord-postgresql-extensions.gemspec
@@ -11,6 +11,7 @@ s.description = "A whole bunch of extensions the ActiveRecord PostgreSQL adapter."
s.summary = s.description
s.email = "code@zoocasa.com"
+ s.license = "MIT"
s.extra_rdoc_files = [
"README.rdoc"
]
| Add license details to gemspec.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.