diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/lib/nationaldaylist.rb b/lib/nationaldaylist.rb index abc1234..def5678 100644 --- a/lib/nationaldaylist.rb +++ b/lib/nationaldaylist.rb @@ -3,9 +3,9 @@ class NationalDayList attr_accessor :use_cache - MONTHS= ["january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"] - URL_BASE = "http://www.nationaldaycalendar.com/" - VERSION = '1.0.0' + MONTHS ||= ["january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"] + URL_BASE ||= "http://www.nationaldaycalendar.com/" + VERSION ||= '1.0.0' def initialize(use_cache=true) @use_cache = use_cache
Fix already initialized constant warnings in gem
diff --git a/lib/neography/index.rb b/lib/neography/index.rb index abc1234..def5678 100644 --- a/lib/neography/index.rb +++ b/lib/neography/index.rb @@ -25,7 +25,7 @@ def find(*args) db = args[3] ? args.pop : Neography::Rest.new - if self.inspect == "Neography::Node" + if self.is_a?(Neography::Node) nodes = [] results = db.find_node_index(*args) return nil unless results
Use is_a? instead of inspect to cater to subclasses of Neography::Node
diff --git a/test/integration/so_tech_sha_test.rb b/test/integration/so_tech_sha_test.rb index abc1234..def5678 100644 --- a/test/integration/so_tech_sha_test.rb +++ b/test/integration/so_tech_sha_test.rb @@ -11,6 +11,13 @@ @quizzes.each do |num| get "/sotechsha/#{num}" assert_response :success + assert_equal "/sotechsha/#{num}", path + # TODO: Test 1, 3, and 6 when they are ready + case num + when 0,2,4,5 then + num = num == 0 ? "序" : num + assert_select 'h1', "#{num}章課題 模範解答" + end end end
Add detail test for sotechsha pages
diff --git a/lib/tasks/upgrade.rake b/lib/tasks/upgrade.rake index abc1234..def5678 100644 --- a/lib/tasks/upgrade.rake +++ b/lib/tasks/upgrade.rake @@ -13,6 +13,7 @@ post.save! puts "#{post.title} recreated." end + puts 'All posts have been transfered. Feel free to remove kennedy_posts table... after double check.' end end
Add friendly message to remove kennedy_posts table
diff --git a/lib/whatsapp/client.rb b/lib/whatsapp/client.rb index abc1234..def5678 100644 --- a/lib/whatsapp/client.rb +++ b/lib/whatsapp/client.rb @@ -24,6 +24,14 @@ def auth(password) @connection.auth(password) + end + + def poll_messages + @connection.poll_messages + end + + def get_messages + @connection.get_messages end def send(message)
Add polling messages to public api
diff --git a/rml.gemspec b/rml.gemspec index abc1234..def5678 100644 --- a/rml.gemspec +++ b/rml.gemspec @@ -5,8 +5,8 @@ Gem::Specification.new do |s| s.name = "rml" s.version = RML::VERSION - s.authors = ["Omar Rodriguez"] - s.email = ["omarjavier15@gmail.com"] + s.authors = ["Omar Rodriguez", "Rafael George"] + s.email = ["omarjavier15@gmail.com", "george.rafael@gmail.com"] s.homepage = "" s.summary = %q{Ruby markup language} s.description = %q{RML: Is a DSL for generating HTML from Ruby code}
Modify gemspec to add authors
diff --git a/config/environments/production.rb b/config/environments/production.rb index abc1234..def5678 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -5,9 +5,9 @@ config.active_record.dump_schema_after_migration = false config.active_support.deprecation = :notify config.assets.compile = false - # config.assets.css_compressor = :yui + config.assets.css_compressor = :yui config.assets.digest = true - # config.assets.js_compressor = :uglifier + config.assets.js_compressor = :uglifier config.assets.version = "2.0" config.cache_classes = true config.consider_all_requests_local = false
Add JS and CSS compression back
diff --git a/materialize_it.gemspec b/materialize_it.gemspec index abc1234..def5678 100644 --- a/materialize_it.gemspec +++ b/materialize_it.gemspec @@ -14,14 +14,6 @@ spec.homepage = "https://github.com/HenryTimelessness/materialize_it" spec.license = "MIT" - # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or - # delete this section to allow pushing this gem to any host. - if spec.respond_to?(:metadata) - spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'" - else - raise "RubyGems 2.0 or newer is required to protect against public gem pushes." - end - spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } spec.bindir = "exe" spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
Delete some stuff from gemspec
diff --git a/spec/generative/ordering_spec.rb b/spec/generative/ordering_spec.rb index abc1234..def5678 100644 --- a/spec/generative/ordering_spec.rb +++ b/spec/generative/ordering_spec.rb @@ -13,12 +13,12 @@ end it "does not duplicate regular specs" do - spec = double metadata: {} + spec = double(metadata: {}) expect(ordering.call([spec])).to eq([spec]) end it "duplicates generative specs" do - spec = double metadata: { generative: true } - expect(ordering.call([spec])).to have(10).items + spec = double(metadata: { generative: true }) + expect(ordering.call([spec]).count).to eq(10) end end
Fix spec for RSpec 3
diff --git a/spec/integration/adapter_spec.rb b/spec/integration/adapter_spec.rb index abc1234..def5678 100644 --- a/spec/integration/adapter_spec.rb +++ b/spec/integration/adapter_spec.rb @@ -3,14 +3,15 @@ require 'virtus' describe 'Mongo adapter' do - let(:rom) { ROM.setup(mongo: 'mongo://127.0.0.1:27017/test') } + let(:setup) { ROM.setup(mongo: 'mongo://127.0.0.1:27017/test') } + let(:rom) { setup.finalize } after do rom.mongo.connection.drop end it 'works' do - rom.schema do + setup.schema do base_relation(:users) do repository :mongo @@ -20,13 +21,9 @@ end end - rom.relations do - register(:users) do - - def by_name(name) - find(name: name) - end - + setup.relation(:users) do + def by_name(name) + find(name: name) end end @@ -38,7 +35,7 @@ attribute :email, String end - rom.mappers do + setup.mappers do define(:users) do model(user_model) end
Update spec to latest rom
diff --git a/spec/requests/list_items_spec.rb b/spec/requests/list_items_spec.rb index abc1234..def5678 100644 --- a/spec/requests/list_items_spec.rb +++ b/spec/requests/list_items_spec.rb @@ -0,0 +1,29 @@+require 'rails_helper' + +RSpec.describe "ListItems", type: :request do + let(:headers) { + { "ACCEPT" => "application/json" } + } + + context "Creating a ListItem" do + context "with correct params" do + it "creates a ListItem" do + # We have to create a RequestedItem in order for the ListItem post to + # be successful. Any front end client has to first post to + # /requested_items. + requested_movie = FactoryGirl.create(:requested_item, + name: "Awesome Movie", + requested_type: "Movie") + + post "/list_items", + { list_item: { name: "Awesome Movie", + item_type: "RequestedItem", + item_id: requested_movie.id } }, + headers + + expect(response.content_type).to eq("application/json") + expect(response).to have_http_status(:created) + end + end + end +end
Add request spec for happy-path creating a ListItem
diff --git a/spec/ruby_syntax_checker_spec.rb b/spec/ruby_syntax_checker_spec.rb index abc1234..def5678 100644 --- a/spec/ruby_syntax_checker_spec.rb +++ b/spec/ruby_syntax_checker_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe MountainBerryFields::Test::SyntaxChecker do +describe MountainBerryFields::Test::RubySyntaxChecker do it 'implements the SyntaxChecker interface' do Mock::SyntaxChecker.should substitute_for described_class end
Fix spec file from when renaming to RubySyntaxChecker
diff --git a/spec/support/database_cleaner.rb b/spec/support/database_cleaner.rb index abc1234..def5678 100644 --- a/spec/support/database_cleaner.rb +++ b/spec/support/database_cleaner.rb @@ -1,6 +1,6 @@ RSpec.configure do |config| config.before(:suite) do - DatabaseCleaner.clean_with(:deletion) + DatabaseCleaner.clean_with(:truncation) end config.before(:each) do @@ -8,7 +8,7 @@ end config.before(:each, :js => true) do - DatabaseCleaner.strategy = :deletion + DatabaseCleaner.strategy = :truncation end config.before(:each) do
Fix foreign key errors when resetting DB in tests Problem I couldn't get the test suite passing because of foreign key errors when resetting the DB. For example, ``` Failures: 1) customer show page links to the customer's orders Failure/Error: DatabaseCleaner.clean ActiveRecord::InvalidForeignKey: PG::ForeignKeyViolation: ERROR: update o delete en «customers» viola la llave foránea «fk_rails_3dad120da9» en la tabla «orders» DETAIL: La llave (id)=(1) todavía es referida desde la tabla «orders». : DELETE FROM "public"."customers"; (...backtrace ommited...) Finished in 1.75 seconds (files took 2.03 seconds to load) 1 example, 1 failure Failed examples: rspec ./spec/features/show_page_spec.rb:34 ``` Solution Use "truncation" strategy instead of "deletion" for resetting the DB.
diff --git a/spec/support/database_cleaner.rb b/spec/support/database_cleaner.rb index abc1234..def5678 100644 --- a/spec/support/database_cleaner.rb +++ b/spec/support/database_cleaner.rb @@ -5,8 +5,6 @@ RSpec.configure do |config| config.before :suite do - #DatabaseCleaner.clean_with :truncation - DatabaseCleaner.clean_with :truncation if defined? ActiveRecord DatabaseCleaner.clean_with :truncation if defined? DataMapper DatabaseCleaner.clean_with :truncation if defined? Mongoid
Clean with truncation at the start of each suite. This keeps things working properly for mongo which does not support transactions. The strategy is still properly configured to use transactions where supported, though, so this should not affect the speed of the test suite for other ORMs.
diff --git a/attributes/default.rb b/attributes/default.rb index abc1234..def5678 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -3,13 +3,8 @@ default['android-sdk']['group'] = 'root' default['android-sdk']['setup_root'] = nil # ark defaults (/usr/local) is used if this attribute is not defined - -# # Last version without License Agreement being prompted during setup: -# default['android-sdk']['version'] = '21.1' -# default['android-sdk']['checksum'] = '276e3c13a10f37927d4e04d036a94a0cbbf62326981f0ba61a303b76567e3379' - -default['android-sdk']['version'] = '22.0.5' -default['android-sdk']['checksum'] = 'b664d1024b6fcf897e05eb1674c998df0ed2e4c9c280469445d914f8fcfa4454' +default['android-sdk']['version'] = '22.2.1' +default['android-sdk']['checksum'] = '17ea4610008985eb1454b3b25ad00c59300cee3141f7ea3deec98f45d862faa5' default['android-sdk']['download_url'] = "http://dl.google.com/android/android-sdk_r#{node['android-sdk']['version']}-linux.tgz"
Update to Android SDK r22.2.1
diff --git a/bench/bench_helper.rb b/bench/bench_helper.rb index abc1234..def5678 100644 --- a/bench/bench_helper.rb +++ b/bench/bench_helper.rb @@ -1,6 +1,13 @@ require 'benchmark' -$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) +lib = File.expand_path('../../lib', __FILE__) + +cext = "#{lib}/ffi_c.so" +unless File.exist?(cext) + abort "#{cext} is not compiled. Compile it with 'rake compile' first." +end + +$LOAD_PATH.unshift(lib) require 'ffi' ITER = ENV['ITER'] ? ENV['ITER'].to_i : 100_000
Make sure the C extension is compiled before running benchmarks * Otherwise, the C extension from the gem might be picked instead.
diff --git a/mingo.gemspec b/mingo.gemspec index abc1234..def5678 100644 --- a/mingo.gemspec +++ b/mingo.gemspec @@ -9,8 +9,8 @@ s.authors = ["Chris Hanks"] s.email = ["christopher.m.hanks@gmail.com"] s.homepage = "https://github.com/chanks/mingo" - s.summary = %q{A simple A/B testing engine for Rails 3.} - s.description = %q{A Rails 3 engine for simple A/B testing, with results persisted to MongoDB.} + s.summary = %q{Simple A/B testing for any Ruby project.} + s.description = %q{Simple A/B testing for any Ruby project, with results persisted to MongoDB.} s.rubyforge_project = "mingo"
Update summary and description in .gemspec.
diff --git a/app/controllers/admin/educators_controller.rb b/app/controllers/admin/educators_controller.rb index abc1234..def5678 100644 --- a/app/controllers/admin/educators_controller.rb +++ b/app/controllers/admin/educators_controller.rb @@ -8,13 +8,5 @@ super end - def resource_params - # Transform string for storage as a Postgres array: - params["educator"]["grade_level_access"] = params["educator"]["grade_level_access"].split(', ') - params.require(resource_name).permit(*permitted_attributes, grade_level_access: []) - end - - # See https://administrate-docs.herokuapp.com/customizing_controller_actions - # for more information end end
Remove permitted params code that was throwing an error
diff --git a/db/migrate/20131222143000_rename_user_exercise_reference_on_submissions.rb b/db/migrate/20131222143000_rename_user_exercise_reference_on_submissions.rb index abc1234..def5678 100644 --- a/db/migrate/20131222143000_rename_user_exercise_reference_on_submissions.rb +++ b/db/migrate/20131222143000_rename_user_exercise_reference_on_submissions.rb @@ -0,0 +1,7 @@+class RenameUserExerciseReferenceOnSubmissions < ActiveRecord::Migration + def change + remove_index :submissions, :user_exercise + rename_column :submissions, :user_exercise, :user_exercise_id + add_index :submissions, :user_exercise_id + end +end
Update user exercise column on submission
diff --git a/resources/environment.rb b/resources/environment.rb index abc1234..def5678 100644 --- a/resources/environment.rb +++ b/resources/environment.rb @@ -2,8 +2,6 @@ actions :create, :delete, :nothing default_action :create - -attribute :complete, :kind_of => [TrueClass, FalseClass] attribute :name, :kind_of => String, :regex => Cheffish::NAME_REGEX, :name_attribute => true attribute :description, :kind_of => String @@ -20,3 +18,6 @@ # default_attribute 'ip_address', :delete # override_attribute 'ip_address', '127.0.0.1' # override_attribute [ 'pushy', 'port' ], '8000' + +# Control options +attribute :complete, :kind_of => [TrueClass, FalseClass]
Move control options to the bottom
diff --git a/Casks/adium-nightly15.rb b/Casks/adium-nightly15.rb index abc1234..def5678 100644 --- a/Casks/adium-nightly15.rb +++ b/Casks/adium-nightly15.rb @@ -3,8 +3,15 @@ sha256 '828c2e2f21a2e500aeb580d018afba0f360956334d655a8280d4f9ba09af7b9d' url "http://nightly.adium.im/adium-adium-1.5.11/Adium_#{version}.dmg" + name 'Adium' homepage 'http://nightly.adium.im/?repo_branch=adium-adium-1.5.11' - license :oss + license :gpl app 'Adium.app' + + zap :delete => [ + '~/Library/Caches/Adium', + '~/Library/Caches/com.adiumX.adiumX', + '~/Library/Preferences/com.adiumX.adiumX.plist', + ] end
Add missing stanzas to Adium Nightly15
diff --git a/Casks/firefox-nightly.rb b/Casks/firefox-nightly.rb index abc1234..def5678 100644 --- a/Casks/firefox-nightly.rb +++ b/Casks/firefox-nightly.rb @@ -2,7 +2,7 @@ version :latest sha256 :no_check - url 'http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-trunk/firefox-35.0a1.en-US.mac.dmg' + url 'https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-trunk/firefox-36.0a1.en-US.mac.dmg' homepage 'https://nightly.mozilla.org/' license :oss
Update Firefox Nightly to 36.0a1
diff --git a/Casks/keepingyouawake.rb b/Casks/keepingyouawake.rb index abc1234..def5678 100644 --- a/Casks/keepingyouawake.rb +++ b/Casks/keepingyouawake.rb @@ -1,6 +1,6 @@ cask :v1 => 'keepingyouawake' do - version '1.3' - sha256 'edc08fa7e8504035ab721cc6a2c8fb2c482c5cc82d6666410444738eacaa0748' + version '1.3.1' + sha256 '8a4277fa63d6088f676a34fa82415552eef2122fa49e811ac18a0916689ae1f1' url "https://github.com/newmarcel/KeepingYouAwake/releases/download/#{version}/KeepingYouAwake-#{version}.zip" appcast 'https://github.com/newmarcel/KeepingYouAwake/releases.atom'
Update KeepingYouAwake to latest release
diff --git a/qa/qa/page/group/new.rb b/qa/qa/page/group/new.rb index abc1234..def5678 100644 --- a/qa/qa/page/group/new.rb +++ b/qa/qa/page/group/new.rb @@ -4,6 +4,7 @@ class New < Page::Base def set_path(path) fill_in 'group_path', with: path + fill_in 'group_name', with: path end def set_description(description)
Fix QA group creation by filling required fileds
diff --git a/ReactiveCocoaApply.podspec b/ReactiveCocoaApply.podspec index abc1234..def5678 100644 --- a/ReactiveCocoaApply.podspec +++ b/ReactiveCocoaApply.podspec @@ -10,7 +10,7 @@ s.social_media_url = 'https://twitter.com/leonovco' s.ios.deployment_target = "8.0" - s.osx.deployment_target = "10.9" + s.osx.deployment_target = "10.10" s.requires_arc = true s.source_files = 'Pod/Classes/**/*'
Move macos deployment target to 10.10.
diff --git a/spec/models/configuration_spec.rb b/spec/models/configuration_spec.rb index abc1234..def5678 100644 --- a/spec/models/configuration_spec.rb +++ b/spec/models/configuration_spec.rb @@ -8,7 +8,7 @@ it{ should validate_presence_of :name } it "should be valid from factory" do - @config.should be_valid + expect(@config).to be_valid end context "#get" do @@ -17,14 +17,16 @@ FactoryGirl.create(:configuration, name: 'other_config', value: 'another_value') end it "should get config" do - ::Configuration[:a_config].should == 'a_value' + expect(described_class[:a_config]).to eql('a_value') end - it "should return nil when not founf" do - ::Configuration[:not_found_config].should be(nil) + + it "should return nil when not found" do + expect(described_class[:not_found_config]).to be_nil end it "should return array" do - expected= ['a_value', 'another_value'] - ::Configuration[:a_config, :other_config].should == ['a_value', 'another_value'] + expect( + described_class[:a_config, :other_config] + ).to eql(['a_value', 'another_value']) end end
Use expect syntax for Configuration specs
diff --git a/Casks/adobe-reader-pl.rb b/Casks/adobe-reader-pl.rb index abc1234..def5678 100644 --- a/Casks/adobe-reader-pl.rb +++ b/Casks/adobe-reader-pl.rb @@ -0,0 +1,20 @@+cask :v1 => 'adobe-reader-pl' do + version '11.0.00' + sha256 'cfeeef917cec3175ab7673c9afd9df081794d952c5e919e29a962df21e041b37' + + url "http://ardownload.adobe.com/pub/adobe/reader/mac/#{version.to_i}.x/#{version}/pl_PL/AdbeRdr#{version.gsub('.', '')}_pl_PL.dmg" + name 'Adobe Reader' + homepage 'http://www.adobe.com/pl/products/reader.html' + license :gratis + tags :vendor => 'Adobe' + + pkg 'Adobe Reader XI Installer.pkg' + + uninstall :pkgutil => "com.adobe.acrobat.reader.#{version.gsub('.', '')}.*", + :delete => '/Applications/Adobe Reader.app' + zap :delete => [ + "~/Library/Application Support/Adobe/Acrobat/#{version.sub(%r{(\d+)\.(\d+).*},'\1.\2')}", + '~/Library/Preferences/com.adobe.Reader.plist', + '~/Library/Caches/com.adobe.Reader' + ] +end
Add Adobe Reader 11 Polish version
diff --git a/spec/sisecommerce/produto_spec.rb b/spec/sisecommerce/produto_spec.rb index abc1234..def5678 100644 --- a/spec/sisecommerce/produto_spec.rb +++ b/spec/sisecommerce/produto_spec.rb @@ -31,11 +31,9 @@ end describe '#put' do - let(:produto_put) { } - it 'should change produto nome' do Sisecommerce::Produto.put(id_sku: 1, nome: 'new name') - expect(Sisecommerce::Produto.get(id: 1).nome).to eq 'new name' + expect(Sisecommerce::Produto.get(id_sku: 1).nome).to eq 'new name' end end
Apply fix on put request spec
diff --git a/spec/standalone_appserver_spec.rb b/spec/standalone_appserver_spec.rb index abc1234..def5678 100644 --- a/spec/standalone_appserver_spec.rb +++ b/spec/standalone_appserver_spec.rb @@ -9,7 +9,7 @@ each_machine do |machine| machine.ram = '14680064' machine.vcpus = '8' - machine.image_size = '10G' + machine.modify_storage({ '/'.to_sym => { :size => '10G' } }) end end end @@ -33,7 +33,7 @@ host("e1-timcyclic-002.mgmt.space.net.local") do |host| host.to_specs.shift[:ram].should eql '14680064' host.to_specs.shift[:vcpus].should eql '8' - host.to_specs.shift[:image_size].should eql '10G' + host.to_specs.shift[:storage]['/'.to_sym][:size].should eql '10G' end end
rpearce: Modify standalone app tests from image_size to modify_storage
diff --git a/spec/unit/recipes/default_spec.rb b/spec/unit/recipes/default_spec.rb index abc1234..def5678 100644 --- a/spec/unit/recipes/default_spec.rb +++ b/spec/unit/recipes/default_spec.rb @@ -2,7 +2,7 @@ describe 'default recipe' do let(:chef_run) do - runner = ChefSpec::ServerRunner.new(platform: 'centos', version: '6.8') + runner = ChefSpec::ServerRunner.new(platform: 'centos', version: '6.9') runner.converge('kickstart::default') end
Update specs to the latest platform versions Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
diff --git a/spec/workers/share_worker_spec.rb b/spec/workers/share_worker_spec.rb index abc1234..def5678 100644 --- a/spec/workers/share_worker_spec.rb +++ b/spec/workers/share_worker_spec.rb @@ -0,0 +1,26 @@+# frozen_string_literal: true + +require 'rails_helper' + +describe ShareWorker do + let(:user) { FactoryBot.create(:user) } + let(:answer) { FactoryBot.create(:answer, user: user) } + + describe "#perform" do + subject { ShareWorker.new.perform(user.id, answer.id, 'twitter') } + + before do + Service.create!(type: 'Services::Twitter', + user: user) + end + + context 'when answer doesn\'t exist' do + it 'prevents the job from retrying and logs a message' do + answer.destroy! + Sidekiq.logger.should_receive(:info) + subject + expect(ShareWorker.jobs.size).to eq(0) + end + end + end +end
Test `ShareWorker`'s handling of deleted records
diff --git a/log.gemspec b/log.gemspec index abc1234..def5678 100644 --- a/log.gemspec +++ b/log.gemspec @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'evt-log' - s.version = '1.1.0.0' + s.version = '2.1.0.0' s.summary = 'Logging to STD IO with levels, tagging, and coloring' s.description = ' '
Package version is increased from 1.1.0.0 to 2.1.0.0
diff --git a/app/models/user.rb b/app/models/user.rb index abc1234..def5678 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,7 +1,8 @@ require 'bcrypt' class User < ApplicationRecord - validates :username, presence: true, length: { in: 4..15 }, uniqueness: true + validates :username, presence: true, length: { in: 4..15, length_message: 'Username must be between 4-15 characters in length' }, uniqueness: true + # email validation still needs email format validation validates :email, presence: true, uniqueness: true validates :password, presence: true, length: { in: 4..10 }
Update validation to contain an error message
diff --git a/pages/config/routes.rb b/pages/config/routes.rb index abc1234..def5678 100644 --- a/pages/config/routes.rb +++ b/pages/config/routes.rb @@ -1,6 +1,9 @@ ConstructorPages::Engine.routes.draw do scope '/admin' do - resources :pages, except: [:show] + resources :pages, except: [:show] do + get :new_child, on: :member + end + resources :templates, except: [:show] do resources :fields, except: [:show, :index] end @@ -10,8 +13,6 @@ get "#{c.pluralize}/move/#{d}/:id" => "#{c.pluralize}#move_#{d}", as: "#{c}_move_#{d}" end end - - get '/pages/:page/new' => 'pages#new', as: :new_child_page end root :to => 'pages#show'
Move new_child to pages resources.
diff --git a/app/jobs/sample.rb b/app/jobs/sample.rb index abc1234..def5678 100644 --- a/app/jobs/sample.rb +++ b/app/jobs/sample.rb @@ -14,7 +14,8 @@ Dashing.send_event('past_hour', { value: Device.sightings_past_hour }) Dashing.send_event('past_day', { current: Device.sightings_past_day }) d = Device.last - Dashing.send_event('last_MAC', { text: "#{d.company}", + company = d.company==""? d.company : "Device Manufacturer Not Found" + Dashing.send_event('last_MAC', { text: "#{company}", moreinfo: "MAC Address: #{d.macaddress}"}) #top_manufacturers = [{:label=>"Apple", :value=>50}, { :label=>"HTC", :value=>20}, {:label=>'Samsung', :value=>22}]
Update to have last seen device with not found manufacturers
diff --git a/app/models/link.rb b/app/models/link.rb index abc1234..def5678 100644 --- a/app/models/link.rb +++ b/app/models/link.rb @@ -25,12 +25,9 @@ end doc = Oga.parse_html(body) + title = doc.at_css('title') - if doc.at_css('title') != nil - return doc.at_css('title').text - else - return @url - end + title ? title.text : @url end end
Refactor Link Model to remove duplicate code
diff --git a/app/models/user.rb b/app/models/user.rb index abc1234..def5678 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -12,7 +12,6 @@ # class User < ActiveRecord::Base - validates :name, uniqueness: true validates :email, presence: true, uniqueness: true validates_format_of :email, with: /\@mediagenix\.tv/, message: 'You should have an email from mediagenix.tv'
Remove the name uniqueness contraint
diff --git a/app/models/user.rb b/app/models/user.rb index abc1234..def5678 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -2,6 +2,7 @@ authenticates_with_sorcery! has_many :user_votes + has_many :items, through: :user_votes validates :password, length: { minimum: 8} validates :password, confirmation: true
Add association User has many Items thru UserVotes
diff --git a/config/initializers/delayed_jobs_config.rb b/config/initializers/delayed_jobs_config.rb index abc1234..def5678 100644 --- a/config/initializers/delayed_jobs_config.rb +++ b/config/initializers/delayed_jobs_config.rb @@ -9,8 +9,7 @@ module QueueConfigs - - BLASTER_QUEUE = "blaster" - LIST_CUTTER_QUEUE = "list_cutter" - HIGH_QUEUE = "high" -end+ BLASTER_QUEUE = ENV['BLASTER_QUEUE'] || "blaster" + LIST_CUTTER_QUEUE = ENV['LIST_CUTTER_QUEUE'] || "list_cutter" + HIGH_QUEUE = ENV['LIST_CUTTER_BLASTER_QUEUE'] || "high" +end
Revert "remove ENV variables from the delayed jobs config. It's just unnecessary" This reverts commit 8674d728bd106bafd2375a563aeadce76d04d9c5.
diff --git a/db/migrate/20160605114255_create_brands.rb b/db/migrate/20160605114255_create_brands.rb index abc1234..def5678 100644 --- a/db/migrate/20160605114255_create_brands.rb +++ b/db/migrate/20160605114255_create_brands.rb @@ -2,6 +2,7 @@ def change create_table :brands do |t| t.string :brand_name, null: false + t.string :logo t.text :brand_description t.text :sponsorship_rules
Update brad table to add column for logo path
diff --git a/actioncable/test/subscription_adapter/channel_prefix.rb b/actioncable/test/subscription_adapter/channel_prefix.rb index abc1234..def5678 100644 --- a/actioncable/test/subscription_adapter/channel_prefix.rb +++ b/actioncable/test/subscription_adapter/channel_prefix.rb @@ -5,7 +5,7 @@ module ChannelPrefixTest def test_channel_prefix server2 = ActionCable::Server::Base.new(config: ActionCable::Server::Configuration.new) - server2.config.cable = alt_cable_config + server2.config.cable = alt_cable_config.with_indifferent_access server2.config.logger = Logger.new(StringIO.new).tap { |l| l.level = Logger::UNKNOWN } adapter_klass = server2.config.pubsub_adapter
Use indifferent access for config hash in actioncable postgresql test
diff --git a/ARSlidingPanel.podspec b/ARSlidingPanel.podspec index abc1234..def5678 100644 --- a/ARSlidingPanel.podspec +++ b/ARSlidingPanel.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "ARSlidingPanel" - s.version = "0.1.0" + s.version = "0.1.1" s.summary = "ARSlidingPanel is a realization of sliding-up panel for iOS" s.description = <<-DESC
Bump the podspec file to 0.1.1 to reflect changes Please add a tag `0.1.1` and push it to the Cocopods specs repo using `pod spec push`
diff --git a/lib/fireap/view_model/application_node.rb b/lib/fireap/view_model/application_node.rb index abc1234..def5678 100644 --- a/lib/fireap/view_model/application_node.rb +++ b/lib/fireap/view_model/application_node.rb @@ -4,9 +4,8 @@ class ApplicationNode attr :appname, :version, :semaphore, :updated_at, :remote_node - # Arguments: - # - app: Fireap::Model::Application - # - node: Fireap::Model::Node + # @param app [Fireap::Model::Application] + # @param node [Fireap::Model::Node] def initialize(app, node) @app = app @@ -19,9 +18,7 @@ @remote_node = app.update_info ? app.update_info.remote_node : '-' end - #-- - # For sorting in view - #++ + # @note For sorting in view def <=>(other) ret = other.version <=> self.version return ret if ret == 0
Modify comment to use YARD
diff --git a/lib/vagrant-azure/monkey_patch/machine.rb b/lib/vagrant-azure/monkey_patch/machine.rb index abc1234..def5678 100644 --- a/lib/vagrant-azure/monkey_patch/machine.rb +++ b/lib/vagrant-azure/monkey_patch/machine.rb @@ -13,7 +13,7 @@ if @config.vm.guest == :windows @communicator = VagrantPlugins::WinAzure::Communicator::PowerShell.new(self) else - @communicator = original_communicate + @communicator = ssh_communicate.bind(self).() end end @communicator
Call original ssh_communicate for non windows vm
diff --git a/BFRImageViewer.podspec b/BFRImageViewer.podspec index abc1234..def5678 100644 --- a/BFRImageViewer.podspec +++ b/BFRImageViewer.podspec @@ -1,14 +1,24 @@ Pod::Spec.new do |s| s.name = "BFRImageViewer" s.version = "1.0.7" - s.summary = "BFRImageViewer." - s.homepage = "https://bufferapp.com" - s.license = { :type => 'MIT', :file => 'LICENSE' } - s.author = { "Andrew Yates" => "andy@bufferapp.com" } + s.summary = "A turnkey solution to display photos and images of all kinds in your app." + s.description = <<-DESC + The BFRImageViewer is a turnkey solution to present images within your iOS app 🎉! It's based off of the excellent IDMPhotoBrowser, but tweaked for our own needs. + + If features swipe gestures to dismiss, image scaling, zooming and panning, supports multiple images, image types, and plays nicely with 3D touch! We use it all over the place in Buffer for iOS :-). + DESC + s.homepage = "https://github.com/bufferapp/buffer-ios-image-viewer" + s.screenshot = "https://github.com/bufferapp/buffer-ios-image-viewer/blob/master/demo.gif?raw=true" + s.license = "MIT" + s.authors = {"Andrew Yates" => "andy@bufferapp.com", + "Jordan Morgan" => "jordan@bufferapp.com", + "Humber Aquino" => "humber@bufferapp.com"} + s.social_media_url = "https://twitter.com/bufferdevs" s.source = { :git => "https://github.com/bufferapp/buffer-ios-image-viewer.git", :tag => 'v1.0.7' } s.source_files = 'Classes', 'BFRImageViewController/**/*.{h,m}' s.platform = :ios, '8.0' s.requires_arc = true + s.frameworks = "UIKit", "Photos" s.dependency 'DACircularProgress' s.dependency 'SDWebImage' -end +end
Make the pod spec open source friendly
diff --git a/callcredit.gemspec b/callcredit.gemspec index abc1234..def5678 100644 --- a/callcredit.gemspec +++ b/callcredit.gemspec @@ -7,7 +7,7 @@ gem.add_runtime_dependency 'unicode_utils', '~> 1.4.0' gem.add_development_dependency 'rspec', '~> 3.8.0' - gem.add_development_dependency 'webmock', '~> 3.5.1' + gem.add_development_dependency 'webmock', '~> 3.6.0' gem.add_development_dependency 'rubocop' gem.authors = ['Grey Baker']
Update webmock requirement from ~> 3.5.1 to ~> 3.6.0 Updates the requirements on [webmock](https://github.com/bblimke/webmock) to permit the latest version. - [Release notes](https://github.com/bblimke/webmock/releases) - [Changelog](https://github.com/bblimke/webmock/blob/master/CHANGELOG.md) - [Commits](https://github.com/bblimke/webmock/compare/v3.5.1...v3.6.0)
diff --git a/config/initializers/rails_security_patches.rb b/config/initializers/rails_security_patches.rb index abc1234..def5678 100644 --- a/config/initializers/rails_security_patches.rb +++ b/config/initializers/rails_security_patches.rb @@ -0,0 +1,22 @@+# Temporary patches for Rails security alert made on 03/12/2013 + +# CVE-2013-6414 https://groups.google.com/forum/#!topic/rubyonrails-security/A-ebV4WxzKg + +ActiveSupport.on_load(:action_view) do + ActionView::LookupContext::DetailsKey.class_eval do + class << self + alias :old_get :get + + def get(details) + if details[:formats] + details = details.dup + syms = Set.new Mime::SET.symbols + details[:formats] = details[:formats].select { |v| + syms.include? v + } + end + old_get details + end + end + end +end
Apply monkey patch for CVE-2013-6414.
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index abc1234..def5678 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -13,11 +13,20 @@ expect(@user1.following).to include @user2 end + it "follows other users correctly" do + expect(@user2.followers).to include @user1 + end + it "unfollows other users correctly" do @user1.unfollow(@user2) expect(@user1.following).not_to include @user2 end + it "unfollows other users correctly" do + @user1.unfollow(@user2) + expect(@user2.followers).not_to include @user1 + end + end end
Add more user model tests for following, unfollowing
diff --git a/spec/round_robin_spec.rb b/spec/round_robin_spec.rb index abc1234..def5678 100644 --- a/spec/round_robin_spec.rb +++ b/spec/round_robin_spec.rb @@ -1,6 +1,11 @@ require 'spec_helper' describe RoundRobin do describe "#add" do + it "should return a Job that descends from ActiveRecord::Base" do + job = RoundRobin.add(MyJob, 42) + job.should be_a ActiveRecord::Base + end + it "should add a job when calling add" do lambda do RoundRobin.add(MyJob, 42)
Check that RoundRobin.add returns an ActiveRecord object
diff --git a/ruby/product-change.rb b/ruby/product-change.rb index abc1234..def5678 100644 --- a/ruby/product-change.rb +++ b/ruby/product-change.rb @@ -24,7 +24,8 @@ #subscription.product_change('annual-plan') -#subscription.delayed_product_change('monthly-plan') +# schedule the product change for the next renewal +#subscription.product_change('monthly-plan', true) #subscription.cancel_delayed_product_change
Update method signature for delayed cancel
diff --git a/hawk.gemspec b/hawk.gemspec index abc1234..def5678 100644 --- a/hawk.gemspec +++ b/hawk.gemspec @@ -18,6 +18,5 @@ gem.require_paths = ["lib"] gem.add_dependency('aws-sdk', '~> 1.8') - gem.add_dependency('xcodeproj', '~> 0.4') gem.add_dependency('osx-plist', '~> 1.0') end
Remove stale dependency on xcodeproj
diff --git a/ci_environment/perlbrew/recipes/default.rb b/ci_environment/perlbrew/recipes/default.rb index abc1234..def5678 100644 --- a/ci_environment/perlbrew/recipes/default.rb +++ b/ci_environment/perlbrew/recipes/default.rb @@ -13,7 +13,7 @@ code <<-SH curl -s https://raw.githubusercontent.com/gugod/App-perlbrew/master/perlbrew-install -o /tmp/perlbrew-installer chmod +x /tmp/perlbrew-installer - bash /tmp/perlbrew-installer + /tmp/perlbrew-installer SH not_if "test -d #{node.travis_build_environment.home}/perl5/perlbrew" end
Revert "Invoke perlbrew-installer with bash" This reverts commit dcf629c3a43d84d815d36c71ed06d11f6faa71ed. https://github.com/gugod/App-perlbrew/issues/407 has been fixed.
diff --git a/lib/localizable_routes/extensions/action_dispatch/named_route_collection.rb b/lib/localizable_routes/extensions/action_dispatch/named_route_collection.rb index abc1234..def5678 100644 --- a/lib/localizable_routes/extensions/action_dispatch/named_route_collection.rb +++ b/lib/localizable_routes/extensions/action_dispatch/named_route_collection.rb @@ -7,7 +7,13 @@ def define_localized_url_helper(name, localization) %w(path url).each do |type| helper = :"#{name}_#{type}" - target = instance_variable_get("@#{type}_helpers_module") + + if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2 + target = instance_variable_get("@#{type}_helpers_module") + else + target = @module + end + target.remove_possible_method helper target.module_eval do define_method helper do |*args| @@ -22,7 +28,12 @@ send "#{name}_#{locale}_#{type}", *(args << options) end end - instance_variable_get("@#{type}_helpers") << helper + + if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2 + instance_variable_get("@#{type}_helpers") << helper + else + helpers << helper + end end end
Fix rails 4.1 and 4.0 compatibility
diff --git a/alki.gemspec b/alki.gemspec index abc1234..def5678 100644 --- a/alki.gemspec +++ b/alki.gemspec @@ -18,9 +18,7 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] - spec.add_development_dependency "bundler", "~> 1.6" - spec.add_development_dependency "rake", '~> 10.0' - spec.add_dependency "alki-dsl", "~> 0.5" + spec.add_dependency "alki-dsl", "~> 0.5", '>= 0.5.1' spec.add_dependency "alki-support", "~> 0.7" spec.add_dependency "concurrent-ruby", "~> 1.0" spec.add_dependency "ice_nine", "~> 0.11"
Remove development dependencies from gemspec
diff --git a/lib/aptible/api/database.rb b/lib/aptible/api/database.rb index abc1234..def5678 100644 --- a/lib/aptible/api/database.rb +++ b/lib/aptible/api/database.rb @@ -35,6 +35,12 @@ def provisioned? status == 'provisioned' end + + def current_configuration_with_deleted + id = links['current_configuration'].href.split('/').last + Aptible::Api::Configuration.find( + id, with_deleted: true, token: token, headers: headers) + end end end end
Add ability to look at deleted configs
diff --git a/TastyTomato.podspec b/TastyTomato.podspec index abc1234..def5678 100644 --- a/TastyTomato.podspec +++ b/TastyTomato.podspec @@ -25,5 +25,5 @@ } s.resources = ['TastyTomato/Images/*.{xcassets, png}'] s.public_header_files = [] - s.dependency 'SignificantSpices', '~> 0.1.0' + s.dependency 'SignificantSpices', '~> 0.2.0' end
Update Spices dependency in Podspec
diff --git a/lib/chrono_model/railtie.rb b/lib/chrono_model/railtie.rb index abc1234..def5678 100644 --- a/lib/chrono_model/railtie.rb +++ b/lib/chrono_model/railtie.rb @@ -2,16 +2,8 @@ class Railtie < ::Rails::Railtie ActiveRecord::Tasks::DatabaseTasks.register_task /chronomodel/, ActiveRecord::Tasks::PostgreSQLDatabaseTasks - setup = proc { ActiveRecord::Base.connection.chrono_setup! } - rake_tasks do load 'chrono_model/schema_format.rake' - - namespace :db do - namespace(:chrono) { task :model, &setup } - end - - task 'db:schema:load' => 'db:chrono:model' end end end
Remove the last useless initialization bit :yum:
diff --git a/config/schedule.rb b/config/schedule.rb index abc1234..def5678 100644 --- a/config/schedule.rb +++ b/config/schedule.rb @@ -1,7 +1,7 @@ # This file is overwritten on deploy set :output, {:error => 'log/cron.error.log', :standard => 'log/cron.log'} -job_type :rake, 'cd :path && /usr/local/bin/govuk_setenv publisher bundle exec rake :task' -job_type :run_script, 'cd :path && RAILS_ENV=:environment /usr/local/bin/govuk_setenv publisher script/:task' +job_type :rake, 'cd :path && /usr/local/bin/govuk_setenv publisher bundle exec rake :task :output' +job_type :run_script, 'cd :path && RAILS_ENV=:environment /usr/local/bin/govuk_setenv publisher script/:task :output' every 1.day, :at => '5am' do rake "local_transactions:fetch"
Add :output to whenever job definitions
diff --git a/lib/cru_lib/access_token.rb b/lib/cru_lib/access_token.rb index abc1234..def5678 100644 --- a/lib/cru_lib/access_token.rb +++ b/lib/cru_lib/access_token.rb @@ -28,6 +28,10 @@ def redis_key(token) ['cru_lib:access_token', token].join(':') end + + def del(token) + redis_client.del(redis_key(token)) + end end private
Add method to delete a token
diff --git a/app/controllers/events_controller.rb b/app/controllers/events_controller.rb index abc1234..def5678 100644 --- a/app/controllers/events_controller.rb +++ b/app/controllers/events_controller.rb @@ -35,7 +35,6 @@ if event["venue"]["city"].downcase == city.downcase results << event end - sleep 0.1 end return results end
Remove sleep from refine_results method to make page load faster
diff --git a/app/controllers/traces_controller.rb b/app/controllers/traces_controller.rb index abc1234..def5678 100644 --- a/app/controllers/traces_controller.rb +++ b/app/controllers/traces_controller.rb @@ -6,8 +6,8 @@ .includes(:spans) .includes(:application) .where(origin: nil) - .order(start: :desc) - .limit(200) + .order(stop: :desc) + .limit(500) render locals: {traces: traces} end
Change trace sorting in UI Traces are not sorted by stop date instead of start date to avoid having slow requests not being shown because start date is already late by too many other traces.
diff --git a/spec/supports_resource_locking.rb b/spec/supports_resource_locking.rb index abc1234..def5678 100644 --- a/spec/supports_resource_locking.rb +++ b/spec/supports_resource_locking.rb @@ -14,10 +14,11 @@ end def test_lock_makes_request + skip if RUBY_VERSION < "1.9" + subject.id = "tst-12345" - stub_request(:put, "http://localhost/1.0/#{collection_name}/tst-12345/lock_resource?account_id=") - .to_return(:status => 200, :body => "{}", :headers => {}) + stub_request(:put, "http://localhost/1.0/#{collection_name}/tst-12345/lock_resource?account_id=").to_return(:status => 200, :body => "{}", :headers => {}) subject.lock! end @@ -27,10 +28,11 @@ end def test_unlock_makes_request + skip if RUBY_VERSION < "1.9" + subject.id = "tst-12345" - stub_request(:put, "http://localhost/1.0/#{collection_name}/tst-12345/unlock_resource?account_id=") - .to_return(:status => 200, :body => "{}", :headers => {}) + stub_request(:put, "http://localhost/1.0/#{collection_name}/tst-12345/unlock_resource?account_id=").to_return(:status => 200, :body => "{}", :headers => {}) subject.unlock! end
Fix 1.8.7 parsing and skip
diff --git a/Casks/parallels.rb b/Casks/parallels.rb index abc1234..def5678 100644 --- a/Casks/parallels.rb +++ b/Casks/parallels.rb @@ -1,20 +1,31 @@ class Parallels < Cask - version '9.0.24237.1028877' - sha256 'da71645ff1f0076ab5b2f8fa5eefb63bcd921e5f52161fd4dd85e6fb19ae2c57' + version '10.0.2-27712' + sha256 'be7f850b1bbe813c16521ff784d85d46fc01ebbb40b8e02352e38e2add704591' - url "http://download.parallels.com/desktop/v9/update2.hotfix2/ParallelsDesktop-#{version}.dmg" + url "http://download.parallels.com/desktop/v10/updates/#{version.gsub(/-.*$/, '')}/ParallelsDesktop-#{version}.dmg" homepage 'http://www.parallels.com/products/desktop/' license :commercial - pkg 'Install.mpkg' + app 'Parallels Desktop.app' - uninstall :pkgutil => 'com.parallels.pkg.virtualization.bundle', - :kext => [ - 'com.parallels.kext.usbconnect', - 'com.parallels.kext.hypervisor', - 'com.parallels.kext.hidhook', - 'com.parallels.kext.netbridge', - 'com.parallels.kext.vnic', - ] - zap :delete => '~/.parallels_settings' + uninstall_preflight do + # Need to change the ownership so that we can do the uninstall. Running Parallels Desktop changes owner to root + ohai "To uninstall Parallels Desktop 10, we need to change permissions, your password may be required." + system '/usr/bin/sudo', '-E', '--', 'chown', '-R', "#{ENV['USER']}", destination_path.join("Parallels Desktop.app") + end + uninstall_postflight do + # Need to remove these files that get symlinked into /usr/bin + system '/usr/bin/sudo', '-E', '--', 'rm', '-f', '/usr/bin/prl_convert' + system '/usr/bin/sudo', '-E', '--', 'rm', '-f', '/usr/bin/prl_disk_tool' + system '/usr/bin/sudo', '-E', '--', 'rm', '-f', '/usr/bin/prl_perf_ctl' + system '/usr/bin/sudo', '-E', '--', 'rm', '-f', '/usr/bin/prlctl' + system '/usr/bin/sudo', '-E', '--', 'rm', '-f', '/usr/bin/prlsrvctl' + end + + caveats <<-EOS.undent + The first time you run Parallels Desktop, you will need to enter your + password in order to complete the installation. + + EOS + end
Update to install Parallels Desktop 10
diff --git a/lib/unf/normalizer_cruby.rb b/lib/unf/normalizer_cruby.rb index abc1234..def5678 100644 --- a/lib/unf/normalizer_cruby.rb +++ b/lib/unf/normalizer_cruby.rb @@ -1,8 +1,7 @@-begin - require 'unf_ext' -rescue LoadError - String.method_defined?(:unicode_normalize) or raise - +case +when defined?(UNF::Normalizer) + # Probably unf_ext is preloaded. +when String.method_defined?(:unicode_normalize) class String [:nfc, :nfd, :nfkc, :nfkd].each { |form| eval %{ @@ -20,4 +19,6 @@ end end end +else + require 'unf_ext' end
Use unf_ext even on Ruby >=2.2 if it is preloaded.
diff --git a/activeresource/activeresource.gemspec b/activeresource/activeresource.gemspec index abc1234..def5678 100644 --- a/activeresource/activeresource.gemspec +++ b/activeresource/activeresource.gemspec @@ -13,7 +13,7 @@ s.email = 'david@loudthinking.com' s.homepage = 'http://www.rubyonrails.org' - s.files = Dir['CHANGELOG', 'README.rdoc', 'examples/**/*', 'lib/**/*'] + s.files = Dir['CHANGELOG', 'MIT-LICENSE', 'README.rdoc', 'examples/**/*', 'lib/**/*'] s.require_path = 'lib' s.extra_rdoc_files = %w( README.rdoc )
Add the MIT-LICENSE to the Active Resource gemspec
diff --git a/lib/bootstrap-sass/compass_functions.rb b/lib/bootstrap-sass/compass_functions.rb index abc1234..def5678 100644 --- a/lib/bootstrap-sass/compass_functions.rb +++ b/lib/bootstrap-sass/compass_functions.rb @@ -18,7 +18,7 @@ options[:sprockets][:context] else # Compatibility with sprockets pre 2.10.0 - options[:custom][:sprockets_context] + options[:importer].context end end end
Use correct reference to context through the importer Fixes #366 in the correct way, hopefully. I can't cite my sources well, since Sprockets is very difficult to follow... but suffice to say the global options hash sent to the Tilt SASS template engine always has a reference to the Sprockets importer, and the importer always has a reference to the context. Tested with Sprockets 2.2.2 with and without Rails.
diff --git a/lib/clio_client/api/document_version.rb b/lib/clio_client/api/document_version.rb index abc1234..def5678 100644 --- a/lib/clio_client/api/document_version.rb +++ b/lib/clio_client/api/document_version.rb @@ -6,8 +6,8 @@ include ClioClient::Api::Crudable - def download(id) - session.get("#{end_point_url}/#{id}/download") + def download(id, params = {}) + session.get("#{end_point_url}/#{id}/download", params) end private
Add extra params to the download method too
diff --git a/lib/erector/rails/rails_form_builder.rb b/lib/erector/rails/rails_form_builder.rb index abc1234..def5678 100644 --- a/lib/erector/rails/rails_form_builder.rb +++ b/lib/erector/rails/rails_form_builder.rb @@ -4,7 +4,7 @@ def initialize(object_name, object, template, options, proc) @template = template - @parent = ActionView::Helpers::FormBuilder.new(object_name, object, template, options, proc) + @parent = ActionView::Base.default_form_builder.new(object_name, object, template, options, proc) end def method_missing(method_name, *args, &block)
Make sure that we use whatever the default form builder for the app, in case it's been overridden by the user in rails environment.rb, instead of just assuming it's always the ActionView form builder
diff --git a/app/models/manageiq/providers/inventory/persister/builder/storage_manager.rb b/app/models/manageiq/providers/inventory/persister/builder/storage_manager.rb index abc1234..def5678 100644 --- a/app/models/manageiq/providers/inventory/persister/builder/storage_manager.rb +++ b/app/models/manageiq/providers/inventory/persister/builder/storage_manager.rb @@ -7,6 +7,10 @@ end def cloud_volume_snapshots + add_common_default_values + end + + def cloud_volume_types add_common_default_values end
Add cloud_volume_types to storage manager persister
diff --git a/Formula/gambit-scheme.rb b/Formula/gambit-scheme.rb index abc1234..def5678 100644 --- a/Formula/gambit-scheme.rb +++ b/Formula/gambit-scheme.rb @@ -1,9 +1,9 @@ require 'formula' class GambitScheme <Formula - url 'http://www.iro.umontreal.ca/~gambit/download/gambit/v4.5/source/gambc-v4_5_2.tgz' + url 'http://www.iro.umontreal.ca/~gambit/download/gambit/v4.5/source/gambc-v4_5_3.tgz' homepage 'http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php/Main_Page' - md5 '71bd4b5858f807c4a8ce6ce68737db16' + md5 '716ed47b7a73d90c9426a240e9536f67' def options [
Update Gambit Scheme to v4.5.3
diff --git a/lib/repeatable/expression/difference.rb b/lib/repeatable/expression/difference.rb index abc1234..def5678 100644 --- a/lib/repeatable/expression/difference.rb +++ b/lib/repeatable/expression/difference.rb @@ -5,8 +5,6 @@ @included = included @excluded = excluded end - - attr_reader :included, :excluded def include?(date) return false if excluded.include?(date) @@ -21,6 +19,10 @@ return false unless other.is_a?(self.class) included == other.included && excluded == other.excluded end + + protected + + attr_reader :included, :excluded end end end
Make attr_readers protected in Difference Match the existing pattern from other Expressions.
diff --git a/run-test.rb b/run-test.rb index abc1234..def5678 100644 --- a/run-test.rb +++ b/run-test.rb @@ -27,6 +27,7 @@ targets << dir end +succeeded = true targets.each do |target| Dir.chdir(target.to_s) do puts "#{Time.now} running test for #{target}" @@ -34,9 +35,11 @@ args = includes + ["test/run-test.rb"] command = [ruby, *args] - system(command.collect {|arg| "'#{arg.gsub(/'/, '\\\'')}'"}.join(' ')) + unless system(command.collect {|arg| "'#{arg.gsub(/'/, '\\\'')}'"}.join(' ')) + succeeded = false + end puts separator end end - +exit(succeeded)
Exit with non-zero status on failure
diff --git a/lib/travis/logs/sidekiq/send_timings.rb b/lib/travis/logs/sidekiq/send_timings.rb index abc1234..def5678 100644 --- a/lib/travis/logs/sidekiq/send_timings.rb +++ b/lib/travis/logs/sidekiq/send_timings.rb @@ -11,7 +11,7 @@ class SendTimings include ::Sidekiq::Worker - sidekiq_options queue: 'send_timing', retry: 3, + sidekiq_options queue: 'send_timings', retry: 3, unique: :until_and_while_executing def perform(job_id)
Set queue name correctly for Worker
diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index abc1234..def5678 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -1,5 +1,6 @@ class WelcomeController < ApplicationController def index - @yellow_jersey = Trip.group(:user).order('sum_distance_in_meter DESC').sum(:distance_in_meter) + season = Season.default + @yellow_jersey = Trip.where(trip_date: season.start_date..season.end_date).group(:user).order('sum_distance_in_meter DESC').sum(:distance_in_meter) end end
Fix yellow jersey on homepage
diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index abc1234..def5678 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -5,7 +5,7 @@ def index if current_user - redirect_to welcome_spending_proposals_path + redirect_to :proposals end end
Revert "makes the "default" url for logged-in users the spending proposals welcome" This reverts commit 26ded993378c7554954a2b2392d27bd0f17d73f4.
diff --git a/app/models/spree/address_decorator.rb b/app/models/spree/address_decorator.rb index abc1234..def5678 100644 --- a/app/models/spree/address_decorator.rb +++ b/app/models/spree/address_decorator.rb @@ -35,7 +35,6 @@ end def render_address(parts) - filtered_address = parts.select{ |field| !field.nil? && field != '' } - filtered_address.compact.join(', ') + parts.select(&:present?).join(', ') end end
Simplify by using Rails tools
diff --git a/app/validators/exchanger_validator.rb b/app/validators/exchanger_validator.rb index abc1234..def5678 100644 --- a/app/validators/exchanger_validator.rb +++ b/app/validators/exchanger_validator.rb @@ -8,7 +8,7 @@ def is_valid_exchanger?(record, value) transformer = options.fetch(:transform, nil) if transformer - value = transformer.call(record, value) + value = transformer.is_a?(Symbol) ? record.send(transformer, value) : transformer.call(record, value) end ActiveExchanger::Base.find_by value
Implement method_or_callable pattern for transformer
diff --git a/unparser.gemspec b/unparser.gemspec index abc1234..def5678 100644 --- a/unparser.gemspec +++ b/unparser.gemspec @@ -1,26 +1,28 @@ # -*- encoding: utf-8 -*- -Gem::Specification.new do |s| - s.name = 'unparser' - s.version = '0.1.6' +Gem::Specification.new do |gem| + gem.name = 'unparser' + gem.version = '0.1.6' - s.authors = ['Markus Schirp'] - s.email = 'mbj@schir-dso.com' - s.summary = 'Generate equivalent source for parser gem AST nodes' - s.description = s.summary - s.homepage = 'http://github.com/mbj/unparser' - s.license = 'MIT' + gem.authors = ['Markus Schirp'] + gem.email = 'mbj@schir-dso.com' + gem.summary = 'Generate equivalent source for parser gem AST nodes' + gem.description = gem.summary + gem.homepage = 'http://github.com/mbj/unparser' + gem.license = 'MIT' - s.files = `git ls-files`.split("\n") - s.test_files = `git ls-files -- {spec,features}/*`.split("\n") - s.require_paths = %w(lib) - s.extra_rdoc_files = %w(README.md) - s.executables = [ 'unparser' ] + gem.files = `git ls-files`.split("\n") + gem.test_files = `git ls-files -- {spec,features}/*`.split("\n") + gem.require_paths = %w(lib) + gem.extra_rdoc_files = %w(README.md) + gem.executables = [ 'unparser' ] - s.add_dependency('parser', '~> 2.1.0') - s.add_dependency('procto', '~> 0.0.2') - s.add_dependency('concord', '~> 0.1.4') - s.add_dependency('adamantium', '~> 0.1') - s.add_dependency('equalizer', '~> 0.0.7') - s.add_dependency('abstract_type', '~> 0.0.7') + gem.required_ruby_version + + gem.add_dependency('parser', '~> 2.1.0') + gem.add_dependency('procto', '~> 0.0.2') + gem.add_dependency('concord', '~> 0.1.4') + gem.add_dependency('adamantium', '~> 0.1') + gem.add_dependency('equalizer', '~> 0.0.7') + gem.add_dependency('abstract_type', '~> 0.0.7') end
Set gem.required_ruby_version to >= 1.9.3
diff --git a/git_awesome_diff.gemspec b/git_awesome_diff.gemspec index abc1234..def5678 100644 --- a/git_awesome_diff.gemspec +++ b/git_awesome_diff.gemspec @@ -6,7 +6,7 @@ gem.email = ["max-prokopiev@yandex.ru", "me@timurv.ru"] gem.description = %q{Object Oriented Diffing for Git} gem.summary = %q{Object Oriented Diffing for Git} - gem.homepage = "https://github.com/fs/git_awesome_diff" + gem.homepage = "https://github.com/fs/git-awesome-diff" gem.add_development_dependency "grit" gem.add_development_dependency "rake"
Correct link to the repo
diff --git a/lib/hash_map.rb b/lib/hash_map.rb index abc1234..def5678 100644 --- a/lib/hash_map.rb +++ b/lib/hash_map.rb @@ -3,4 +3,7 @@ require 'active_support/all' module HashMap # Your code goes here... + def self.root + File.expand_path '../..', __FILE__ + end end
Add helpful method root in HashMap module
diff --git a/lib/web_hook.rb b/lib/web_hook.rb index abc1234..def5678 100644 --- a/lib/web_hook.rb +++ b/lib/web_hook.rb @@ -0,0 +1,40 @@+class WebHook + + # List of attached web hook URLs. + # + URLs = [ + "http://metrics.cocoapods.org/hooks/trunk/#{ENV['OUTGOING_HOOK_PATH']}" + ] + + # Fifo file location. + # + def self.fifo + './tmp/web_hook_calls' + end + + # Set up FIFO file (the "queue"). + # + `mkfifo #{fifo}` + + # Use in Trunk to notify all attached services. + # + # Note: Blocks. + # + def self.call message + `#{message} > #{fifo}` + end + + # Used in the worker process to process hook calls. + # + # Reads from + # + def self.run + while do + message = `cat #{fifo}` + URLs.each do |url| + `curl #{url} -d"#{message}" --max-time 1` + end + end + end + +end
[Webhook] Add a minimal webhook implementation.
diff --git a/app/presenters/gui_presenter.rb b/app/presenters/gui_presenter.rb index abc1234..def5678 100644 --- a/app/presenters/gui_presenter.rb +++ b/app/presenters/gui_presenter.rb @@ -1,10 +1,13 @@ class GuiPresenter - attr_reader :guis_info + def read_gui_yaml + puts "READING YML" + yaml = YAML.load_file('resources/guis.yml') + return yaml["guis"] + end def initialize - yaml = YAML.load_file('resources/guis.yml') - @guis_info = yaml["guis"] + @guis_info = read_gui_yaml end @@instance = GuiPresenter.new @@ -13,5 +16,14 @@ return @@instance end + def guis_info + if Rails.env.production? + return @guis_info + else + return read_gui_yaml + end + end + private_class_method :new + private :read_gui_yaml end
Make gui clients yaml to be read in every request in non-production environments
diff --git a/app/models/iep_document.rb b/app/models/iep_document.rb index abc1234..def5678 100644 --- a/app/models/iep_document.rb +++ b/app/models/iep_document.rb @@ -1,4 +1,4 @@ class IepDocument < ActiveRecord::Base belongs_to :student - validates :file_name, uniqueness: { scope: :file_date, message: "one unique file name per date" } + validates :file_name, presence: true, uniqueness: true end
Remove file date from validation
diff --git a/lib/dalli.rb b/lib/dalli.rb index abc1234..def5678 100644 --- a/lib/dalli.rb +++ b/lib/dalli.rb @@ -4,7 +4,7 @@ require 'dalli/version' require 'dalli/options' -unless String.respond_to?(:bytesize) +unless ''.respond_to?(:bytesize) class String alias_method :bytesize, :size end
Fix bytesize check, closes GH-36
diff --git a/app/models/user_request.rb b/app/models/user_request.rb index abc1234..def5678 100644 --- a/app/models/user_request.rb +++ b/app/models/user_request.rb @@ -4,7 +4,7 @@ enum status: [ :Pending, :Accepted, :Rejected ] - validates :status, inclusion: { in: statuses.keys } + validates :status, inclusion: { in: statuses.keys, allow_blank: true } validates_presence_of :team, :user
Allow blank user request status (defaults to pending on the database).
diff --git a/glimpse-dalli.gemspec b/glimpse-dalli.gemspec index abc1234..def5678 100644 --- a/glimpse-dalli.gemspec +++ b/glimpse-dalli.gemspec @@ -17,5 +17,6 @@ gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) gem.require_paths = ['lib'] + gem.add_dependency 'glimpse' gem.add_dependency 'dalli' end
Add dependency on glimpse now that it's on RubyGems
diff --git a/config/initializers/forbidden_yaml.rb b/config/initializers/forbidden_yaml.rb index abc1234..def5678 100644 --- a/config/initializers/forbidden_yaml.rb +++ b/config/initializers/forbidden_yaml.rb @@ -0,0 +1,59 @@+# XXX: This is purely a monkey patch to close the exploit vector for now, a more +# permanent solution should be pushed upstream into rubygems. + +require "rubygems" + +# Assert we're using Psych +abort "Use Psych for YAML, install libyaml and reinstall ruby" unless YAML == Psych + +module Psych + class ForbiddenClassException < Exception + end + + module Visitors + class WhitelistedToRuby < ToRuby + WHITELIST = %w( + Gem::Dependency + Gem::Platform + Gem::Requirement + Gem::Specification + Gem::Version + Gem::Version::Requirement + ) + + private + + def resolve_class klassname + raise ForbiddenClassException, "Forbidden class in YAML: #{klassname}" unless WHITELIST.include? klassname + super klassname + end + end + end +end + +module Gem + class Specification + def self.from_yaml input + input = normalize_yaml_input input + nodes = Psych.parse input + spec = Psych::Visitors::WhitelistedToRuby.new.accept nodes + + if spec && spec.class == FalseClass then + raise Gem::EndOfYAMLException + end + + unless Gem::Specification === spec then + raise Gem::Exception, "YAML data doesn't evaluate to gem specification" + end + + unless (spec.instance_variables.include? '@specification_version' or + spec.instance_variables.include? :@specification_version) and + spec.instance_variable_get :@specification_version + spec.instance_variable_set :@specification_version, + NONEXISTENT_SPECIFICATION_VERSION + end + + spec + end + end +end
Patch YAML to allow only some Gem classes to be unmarshalled
diff --git a/lib/docuvator.rb b/lib/docuvator.rb index abc1234..def5678 100644 --- a/lib/docuvator.rb +++ b/lib/docuvator.rb @@ -20,9 +20,6 @@ def parse_options OptionParser.new do |opt| opt.version = VERSION - opt.on "-v", "--verbose", "Verbose output (shows INFO level log statements)" do - options.verbose = true - end opt.on "-d", "--debug", "Debug output (shows DEBUG level log statements)" do options.debug = true end @@ -35,7 +32,7 @@ if options.debug Log.level = Logger::DEBUG Log.use_debug - elsif options.verbose + else Log.level = Logger::INFO end end
Remove --verbose option, INFO log level is now default Remove: * The --verbose option Change: * Default log level to INFO
diff --git a/whiteout.gemspec b/whiteout.gemspec index abc1234..def5678 100644 --- a/whiteout.gemspec +++ b/whiteout.gemspec @@ -23,5 +23,5 @@ s.add_development_dependency "rspec" s.add_development_dependency "ronn" - # s.add_runtime_dependency "rest-client" + s.add_development_dependency "rake" end
Add rake as a development dependency
diff --git a/controllers/attachments_controller.rb b/controllers/attachments_controller.rb index abc1234..def5678 100644 --- a/controllers/attachments_controller.rb +++ b/controllers/attachments_controller.rb @@ -8,6 +8,8 @@ upload = Attachment.new performance_id: 4 upload.filename = params[:image] upload.save + + status 200 end end end
Return status in Attachments Controller
diff --git a/app/controllers/cart_controller.rb b/app/controllers/cart_controller.rb index abc1234..def5678 100644 --- a/app/controllers/cart_controller.rb +++ b/app/controllers/cart_controller.rb @@ -7,16 +7,16 @@ @cart = @current_user.shopping_cart end - # This method is under construction!! Will come back to it. - # def remove_from_cart(item) - # if logged_in? - # current_user - # find_item - # @current_cart = @current_user.shopping_cart - # @current_cart.delete(item) - # @current_user.save! - # end - # end + def remove_from_cart + if logged_in? + current_user + @item = Item.find_by_id(params[:item_id]) + @current_cart = @current_user.shopping_cart + @current_cart.delete(@item) + @current_user.save! + redirect_to edit_cart_path + end + end def checkout current_user
Update functionality of remove item from shopping cart
diff --git a/app/controllers/main_controller.rb b/app/controllers/main_controller.rb index abc1234..def5678 100644 --- a/app/controllers/main_controller.rb +++ b/app/controllers/main_controller.rb @@ -13,8 +13,7 @@ @events = Event.includes(:audits).where(:project_id => @projects).order("events.created_at DESC").limit(10) # TODO: Limit this. Use batch? - @meetings = Meeting.includes(:project, :meeting_type).where(["start_time > ? and project_id in (?)", Time.now, @projects]) - .order('meetings.start_time') + @meetings = Meeting.includes(:project, :meeting_type).where(["start_time > ? and project_id in (?)", Time.now, @projects]).order('meetings.start_time') # TODO: Limit this. @tasks = Task.includes(:feature, :project).where(:user_id => current_user)
Fix ruby 1.8 syntax issues
diff --git a/lib/priceable.rb b/lib/priceable.rb index abc1234..def5678 100644 --- a/lib/priceable.rb +++ b/lib/priceable.rb @@ -1,29 +1,27 @@+# frozen_string_literal: true + require "priceable/version" module Priceable - SUFFIXES = ["_in_cents", "_in_pennies", "_as_integer"] + SUFFIXES = ["_in_cents", "_in_pennies", "_as_integer"].freeze + def priceable(*price_fields) price_fields.each do |price_field| - suffix = SUFFIXES.detect { |suffix| self.attribute_method? "#{price_field}#{suffix}".to_sym } + suffix = SUFFIXES.detect { |suffix| attribute_method? "#{price_field}#{suffix}" } raise ArgumentError, "Unable to find valid database field for `#{price_field}'" unless suffix + define_method price_field do - unless send("#{price_field}#{suffix}".to_sym).nil? - send("#{price_field}#{suffix}".to_sym) / 100.0 + unless send("#{price_field}#{suffix}").nil? + send("#{price_field}#{suffix}") / 100.0 else 0.0 end end - define_method "#{price_field}=".to_sym do |new_price| - send("#{price_field}#{suffix}=".to_sym, (new_price.to_f * 100).round) + + define_method "#{price_field}=" do |new_price| + send("#{price_field}#{suffix}=", (new_price.to_f * 100).round) end end - - unless Rails::VERSION::MAJOR == 4 && !defined?(ProtectedAttributes) - if self._accessible_attributes? - attr_accessible *price_fields - end - end - end end
Remove attr_accessible and tidy up
diff --git a/lib/rack/etag.rb b/lib/rack/etag.rb index abc1234..def5678 100644 --- a/lib/rack/etag.rb +++ b/lib/rack/etag.rb @@ -3,9 +3,9 @@ module Rack # Automatically sets the ETag header on all String bodies. # - # The ETag header is skipped if ETag or Last-Modified headers - # are sent or if a sendfile body (responds_to :path) is given - # (since such cases should be handled by apacha/nginx). + # The ETag header is skipped if ETag or Last-Modified headers are sent or if + # a sendfile body (body.responds_to :to_path) is given (since such cases + # should be handled by apache/nginx). class ETag def initialize(app) @app = app
Update docs and minor corrections.
diff --git a/lib/spree_redirects/redirect_middleware.rb b/lib/spree_redirects/redirect_middleware.rb index abc1234..def5678 100644 --- a/lib/spree_redirects/redirect_middleware.rb +++ b/lib/spree_redirects/redirect_middleware.rb @@ -6,15 +6,25 @@ end def call(env) - status, headers, body = @app.call(env) - path = [ env["PATH_INFO"], env["QUERY_STRING"] ].join("?").sub(/[\/\?\s]*$/, "").strip - if status == 404 && url = find_redirect(path) - # Issue a "Moved permanently" response with the redirect location - [ 301, { "Location" => url }, [ "Redirecting..." ] ] + begin + # when consider_all_requests_local is false, an exception is raised for 404 + status, headers, body = @app.call(env) + rescue ActionController::RoutingError => e + routing_error = e + end + + if (routing_error.present? or status == 404) + path = [ env["PATH_INFO"], env["QUERY_STRING"] ].join("?").sub(/[\/\?\s]*$/, "").strip + + if url = find_redirect(path) + # Issue a "Moved permanently" response with the redirect location + return [ 301, { "Location" => url }, [ "Redirecting..." ] ] + end else - # Not a 404 or no redirect found, just send the response as is - [ status, headers, body ] + raise routing_error unless Rails.configuration.consider_all_requests_local end + + [ status, headers, body ] end def find_redirect(url)
Fix for redirects on production (consider_all_requests_local = false)
diff --git a/deep_merge.gemspec b/deep_merge.gemspec index abc1234..def5678 100644 --- a/deep_merge.gemspec +++ b/deep_merge.gemspec @@ -6,7 +6,7 @@ s.authors = ["Steve Midgley"] s.date = %q{2011-07-28} - s.description = %q{Recursively merge hashes. Now works with Ruby 1.9 and ActiveSupport} + s.description = %q{Recursively merge hashes.} s.email = %q{dan@kallistec.com} s.license = 'MIT' s.extra_rdoc_files = [
Remove 1.9 messaging on gemspec
diff --git a/lib/bitescript/asm.rb b/lib/bitescript/asm.rb index abc1234..def5678 100644 --- a/lib/bitescript/asm.rb +++ b/lib/bitescript/asm.rb @@ -3,16 +3,25 @@ module BiteScript module ASM begin - # try mangled names for the version included with JRuby + # try mangled names for the version included with JRuby <=1.6.0.RC2 java.lang.Class.for_name 'jruby.objectweb.asm.Opcodes' # no error, proceed with mangled name asm_package = Java::jruby.objectweb.asm java_import asm_package.Opcodes rescue Exception - # fall back on standard names - asm_package = org.objectweb.asm - java_import asm_package.Opcodes + begin + # try mangled names for the version included with JRuby >=1.6.0.RC3 + java.lang.Class.for_name 'org.jruby.org.objectweb.asm.Opcodes' + + # no error, proceed with mangled name + asm_package = Java::org.jruby.org.objectweb.asm + java_import asm_package.Opcodes + rescue + # fall back on standard names + asm_package = org.objectweb.asm + java_import asm_package.Opcodes + end end java_import asm_package.Label java_import asm_package.Type
Update ASM mangled package to reflect JRuby 1.6.0.RC3 and higher.
diff --git a/lib/cask/locations.rb b/lib/cask/locations.rb index abc1234..def5678 100644 --- a/lib/cask/locations.rb +++ b/lib/cask/locations.rb @@ -5,7 +5,7 @@ module ClassMethods def tapspath - HOMEBREW_PREFIX.join "Library", "Taps" + HOMEBREW_REPOSITORY.join "Library", "Taps" end def caskroom
Use HOMEBREW_REPOSITORY instead of HOMEBREW_PREFIX to derive tapspath
diff --git a/spec/validators/email_validator_spec.rb b/spec/validators/email_validator_spec.rb index abc1234..def5678 100644 --- a/spec/validators/email_validator_spec.rb +++ b/spec/validators/email_validator_spec.rb @@ -0,0 +1,24 @@+require 'spec_helper' + + +describe "EmailValidator" do + + before(:each) do + @validator = EmailValidator.new({:attributes => {}}) + @mock = mock('model') + @mock.stub("errors").and_return([]) + @mock.errors.stub('[]').and_return({}) + @mock.errors[].stub('<<') + end + + it "should validate valid address" do + @mock.should_not_receive('errors') + @validator.validate_each(@mock, "email", "test@test.com") + end + + it "should validate invalid address" do + @mock.errors[].should_receive('<<') + @validator.validate_each(@mock, "email", "notvalid") + end + +end
Add test for email validator.
diff --git a/behaviour/effect/blood_taste.rb b/behaviour/effect/blood_taste.rb index abc1234..def5678 100644 --- a/behaviour/effect/blood_taste.rb +++ b/behaviour/effect/blood_taste.rb @@ -15,7 +15,7 @@ heal = intent.attack.entity.hp_max - intent.attack.entity.hp if intent.attack.entity.hp_max - intent.attack.entity.hp < heal if heal > 0 intent.attack.entity.hp += heal - intent.attack.append_message "You gain #{amount} HP from #{@parent.name}." + intent.attack.append_message "You gain #{amount} HP from #{@parent.name}.", :attacker end end end
Apply scope to Blood Taste notification