diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/lib/hamlit/utils.rb b/lib/hamlit/utils.rb index abc1234..def5678 100644 --- a/lib/hamlit/utils.rb +++ b/lib/hamlit/utils.rb @@ -1,10 +1,16 @@ # frozen_string_literal: true -unless /java/ === RUBY_PLATFORM # exclude JRuby - require 'hamlit/hamlit' # depends on C-ext defines Hamlit::Utils first for now -end - module Hamlit module Utils + if /java/ === RUBY_PLATFORM # JRuby + require 'cgi/escape' + + def self.escape_html(html) + CGI.escapeHTML(html.to_s) + end + else + require 'hamlit/hamlit' # Hamlit::Utils.escape_html + end + def self.escape_html_safe(html) html.html_safe? ? html : escape_html(html) end
Support HTML escape for JRuby
diff --git a/spec/active_record_spec_helper.rb b/spec/active_record_spec_helper.rb index abc1234..def5678 100644 --- a/spec/active_record_spec_helper.rb +++ b/spec/active_record_spec_helper.rb @@ -12,6 +12,7 @@ config.include FactoryGirl::Syntax::Methods config.before(:suite) do + FactoryGirl.factories.clear FactoryGirl.find_definitions end
Clear out the FG definitions if they are already defined so there is no duplicate definition error
diff --git a/spec/features/pages/index_spec.rb b/spec/features/pages/index_spec.rb index abc1234..def5678 100644 --- a/spec/features/pages/index_spec.rb +++ b/spec/features/pages/index_spec.rb @@ -2,30 +2,31 @@ describe 'pages#index' do - before :each do - create_logged_in_user - visit georgia.search_pages_url - end + it 'lists various pages' + it 'has hidden drafts rows' + it 'has hidden reviews rows' describe 'create' do + before :each do + login_as_admin + end + context 'with a valid title' do - it 'redirects to edit page', js: true do - pending('Waiting for capybara-webkit to be compatible with Capybara 2.1') - click_link('Add Page') + it 'redirects to show page', js: true do + find('a.js-new-page').click fill_in 'Title', with: 'Foo' click_button('Create') - page.should have_selector('h1', text: "Editing 'Foo'") + page.should have_content 'Foo' end end context 'with an invalid title' do it 'displays an error message', js: true do - pending('Waiting for capybara-webkit to be compatible with Capybara 2.1') - click_link('Add Page') + find('a.js-new-page').click fill_in 'Title', with: '#@$%^&' click_button('Create') - expect(page).to have_selector('.alert-error', text: "You need a valid and unique page title. Your page title can only consist of letters, numbers, dash (-) and underscore (_)") + page.should have_selector('.alert-error', text: "You need a valid and unique page title. Your page title can only consist of letters, numbers, dash (-) and underscore (_)") end end
Add specs for page creation
diff --git a/spec/integration/database_test.rb b/spec/integration/database_test.rb index abc1234..def5678 100644 --- a/spec/integration/database_test.rb +++ b/spec/integration/database_test.rb @@ -4,6 +4,12 @@ specify "should provide disconnect functionality" do INTEGRATION_DB.test_connection INTEGRATION_DB.pool.size.should == 1 + INTEGRATION_DB.disconnect + INTEGRATION_DB.pool.size.should == 0 + end + + specify "should provide disconnect functionality after preparing a connection" do + INTEGRATION_DB['SELECT 1'].prepare(:first, :a).call INTEGRATION_DB.disconnect INTEGRATION_DB.pool.size.should == 0 end
Add integration test for disconnecting after calling a prepared statement
diff --git a/lib/meetupanator.rb b/lib/meetupanator.rb index abc1234..def5678 100644 --- a/lib/meetupanator.rb +++ b/lib/meetupanator.rb @@ -1,4 +1,5 @@ require 'meetupanator/app' +require 'meetupanator/cli' require 'meetupanator/event_finder' require 'meetupanator/event_list_file_writer' require 'meetupanator/meetup_api'
Fix broken command line app.
diff --git a/lib/caulfield.rb b/lib/caulfield.rb index abc1234..def5678 100644 --- a/lib/caulfield.rb +++ b/lib/caulfield.rb @@ -9,6 +9,8 @@ end end -ActiveSupport.on_load(:before_initialize) do - Rails.configuration.middleware.use Caulfield::Middleware +if defined?(Rails) && Rails.version >= '3.0.0.beta4' + ActiveSupport.on_load :before_initialize do + Rails.configuration.middleware.use Caulfield::Middleware + end end
Check if Rails is being used and the right version before inserting the middleware.
diff --git a/lib/remindice.rb b/lib/remindice.rb index abc1234..def5678 100644 --- a/lib/remindice.rb +++ b/lib/remindice.rb @@ -2,6 +2,8 @@ require "thor" module Remindice + TASK_FILENAME = "~/.reamindice_tasks" + @@tasks = if File.exists?(TASK_FILENAME); File.readlines(TASK_FILENAME) else [] end class Commands < Thor end end
Load tasks from the constant file name
diff --git a/spec-tests/spec/localhost/tor_spec.rb b/spec-tests/spec/localhost/tor_spec.rb index abc1234..def5678 100644 --- a/spec-tests/spec/localhost/tor_spec.rb +++ b/spec-tests/spec/localhost/tor_spec.rb @@ -6,5 +6,10 @@ describe file('/etc/tor/torrc') do it { should be_file } - its(:content) { should match /SocksPort 0/ } + its(:content) { should contain 'ReachableAddresses *:80,*:8080,*:443,*:8443,*:9001,*:9030' } end + +describe command('service tor status') do + it { should return_exit_status 0 } +end +
Improve tor spect test slightly
diff --git a/spec/classes/repo_spec.rb b/spec/classes/repo_spec.rb index abc1234..def5678 100644 --- a/spec/classes/repo_spec.rb +++ b/spec/classes/repo_spec.rb @@ -8,6 +8,24 @@ end it { is_expected.to compile } + + describe 'with default parameters' do + it { is_expected.to contain_class('apt') } + it { is_expected.to contain_apt__ppa('ppa:jerith/consular') } + end + + describe 'when manage is false' do + let(:params) { { :manage => false } } + it { is_expected.not_to contain_class('apt') } + it { is_expected.not_to contain_apt__ppa('ppa:jerith/consular') } + end + + describe 'with an unknown source' do + let(:params) { { :source => 'test' } } + it do + is_expected.to raise_error(/APT repository 'test' is not supported./) + end + end end end end
Add tests for repo class
diff --git a/spec/models/round_spec.rb b/spec/models/round_spec.rb index abc1234..def5678 100644 --- a/spec/models/round_spec.rb +++ b/spec/models/round_spec.rb @@ -1,5 +1,18 @@ require 'spec_helper' describe Round do - pending "add some examples to (or delete) #{__FILE__}" + describe "#recall" do + let(:competition) { FactoryGirl.create(:competition) } + let(:event) { FactoryGirl.create(:event, competition: competition) } + let(:sub_event) { FactoryGirl.create(:sub_event, event: event) } + let(:round) { FactoryGirl.create(:round, event: event, requested: 6) } + let(:sub_round) { FactoryGirl.create(:sub_round, round: round, sub_event: sub_event) } + let(:couples) { FactoryGirl.create_list(:random_couple, 10, event: event) } + let(:adjudicators) { FactoryGirl.create_list(:random_adjudicator, 7, competition: competition) } + + context "when unambiguous" do + + end + end + end
Set up basic `round` factories.
diff --git a/db/migrate/20140529104412_create_popularity_function.rb b/db/migrate/20140529104412_create_popularity_function.rb index abc1234..def5678 100644 --- a/db/migrate/20140529104412_create_popularity_function.rb +++ b/db/migrate/20140529104412_create_popularity_function.rb @@ -5,7 +5,9 @@ CREATE OR REPLACE FUNCTION ranking(created_at timestamp, vote_count integer) RETURNS NUMERIC AS $$ SELECT ROUND(LOG(2, greatest(vote_count, 1)) + ((EXTRACT(EPOCH FROM created_at) - EXTRACT(EPOCH from timestamp '2014-1-1 0:00')) / 450000)::numeric, 7); $$ LANGUAGE SQL IMMUTABLE; +SPROC + execute <<-SPROC CREATE INDEX index_questions_on_ranking ON questions (ranking(created_at::timestamp, vote_count) DESC); SPROC
Create two different execute fns for debugging
diff --git a/app/models/image.rb b/app/models/image.rb index abc1234..def5678 100644 --- a/app/models/image.rb +++ b/app/models/image.rb @@ -38,6 +38,6 @@ end # Remove nils and duplicates - images.compact.uniq { |image| image.repository } + images.compact.uniq(&:repository) end end
Simplify uniq call w/ symbol-to-proc
diff --git a/app/policies/application_policy.rb b/app/policies/application_policy.rb index abc1234..def5678 100644 --- a/app/policies/application_policy.rb +++ b/app/policies/application_policy.rb @@ -1,4 +1,9 @@ class ApplicationPolicy < ActionPolicy::Base # make :manage? a real catch-all - alias_rule :index?, :create?, to: :manage? + def index? + manage? + end + def create? + manage? + end end
users: Modify catch-all policy to actually work
diff --git a/test/apps/rails3/app/controllers/other_controller.rb b/test/apps/rails3/app/controllers/other_controller.rb index abc1234..def5678 100644 --- a/test/apps/rails3/app/controllers/other_controller.rb +++ b/test/apps/rails3/app/controllers/other_controller.rb @@ -35,4 +35,8 @@ something end end + + def test_render_with_nonsymbol_key + render x => :y + end end
[CSC] Add test for render with nonsymbol keys
diff --git a/lib/real_world_rails/inspectors/view_specs_inspector.rb b/lib/real_world_rails/inspectors/view_specs_inspector.rb index abc1234..def5678 100644 --- a/lib/real_world_rails/inspectors/view_specs_inspector.rb +++ b/lib/real_world_rails/inspectors/view_specs_inspector.rb @@ -3,8 +3,11 @@ class ViewSpecsInspector < Inspector - inspects :specs, %r{/views?/} + inspects :specs, %r{/views/} + def inspect_file(filename) + puts filename + end end end
Print out view spec filename
diff --git a/morpheus.gemspec b/morpheus.gemspec index abc1234..def5678 100644 --- a/morpheus.gemspec +++ b/morpheus.gemspec @@ -8,8 +8,8 @@ spec.version = Morpheus::VERSION spec.authors = ["Tomas D'Stefano"] spec.email = ["[email protected]"] - spec.description = %q{TODO: Write a gem description} - spec.summary = %q{TODO: Write a gem summary} + spec.description = %q{Full text search} + spec.summary = %q{Full text search} spec.homepage = "https://github.com/tomas-stefano/morpheus" spec.license = "MIT"
Add full text search description for now in the gemspec
diff --git a/test/sqwish_test.rb b/test/sqwish_test.rb index abc1234..def5678 100644 --- a/test/sqwish_test.rb +++ b/test/sqwish_test.rb @@ -2,6 +2,7 @@ class SqwishTest < UnitTest setup do + app.set :reload_templates, true app.assets.css_compression :sqwish, :strict => true end @@ -20,10 +21,10 @@ if sqwish? test "build" do - Sinatra::AssetPack::Compressor - Sinatra::AssetPack::SqwishEngine.any_instance.expects(:css) - + swqished_css = '#bg{background:green;color:red}' + Sinatra::AssetPack::SqwishEngine.any_instance.expects(:css).returns swqished_css get '/css/sq.css' + assert body == swqished_css end else puts "(No Sqwish found; skipping sqwish tests)"
Update sqwish test (need to reload templates)
diff --git a/app/controllers/admin/quotas_controller.rb b/app/controllers/admin/quotas_controller.rb index abc1234..def5678 100644 --- a/app/controllers/admin/quotas_controller.rb +++ b/app/controllers/admin/quotas_controller.rb @@ -2,6 +2,9 @@ def index @years = Quota.years_array + if params[:year] && [email protected]?(params[:year]) + @years = @years.push(params[:year]).sort{|a,b| b <=> a} + end index! end
Include year that is passed from params. (When quotas are duplicated for a new year, that year will not be in the array of years, until they have been copied. This way the interface shows it nevertheless, otherwise users might think it didn't work)
diff --git a/app/controllers/admin/venues_controller.rb b/app/controllers/admin/venues_controller.rb index abc1234..def5678 100644 --- a/app/controllers/admin/venues_controller.rb +++ b/app/controllers/admin/venues_controller.rb @@ -7,8 +7,8 @@ @venues = Venue.non_duplicates # ransack-compatible param-based search (might use real gem later if enough uses) - if params[:latitude_null].presence && params[:longitude_null].presence - @venues = @venues.where(:latitude => nil, :longitude => nil) + if params[:type] == 'missing_lat_long' + @venues = @venues.where('latitude is null or longitude is null') end @venues = @venues.order(:title)
Make venues index use params[:type], like events in admin view
diff --git a/app/controllers/api/v0/users_controller.rb b/app/controllers/api/v0/users_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/v0/users_controller.rb +++ b/app/controllers/api/v0/users_controller.rb @@ -5,7 +5,7 @@ end def search - @users = User.where("first_name LIKE ? or username LIKE ? or last_name LIKE ?", "%#{ params[:q].capitalize }%", "%#{ params[:q] }%", "%#{ params[:q].capitalize }%") + @users = User.where("first_name LIKE ? or username LIKE ? or last_name LIKE ?", "%#{ params[:q]&.capitalize }%", "%#{ params[:q] }%", "%#{ params[:q]&.capitalize }%") render json: @users, each_serializer: UserSerializer end
Add safe operator & for capitalizing params
diff --git a/app/controllers/api/v1/users_controller.rb b/app/controllers/api/v1/users_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/v1/users_controller.rb +++ b/app/controllers/api/v1/users_controller.rb @@ -43,8 +43,7 @@ private def set_user - @user = User.find_by(id: params[:id]) - render json: {message: 'user not found'}, status: :not_found unless @user + @user = User.friendly.find(params[:id]) end def user_params
Implement friendly find in Api::V1::UsersController.
diff --git a/app/controllers/transactions_controller.rb b/app/controllers/transactions_controller.rb index abc1234..def5678 100644 --- a/app/controllers/transactions_controller.rb +++ b/app/controllers/transactions_controller.rb @@ -14,4 +14,15 @@ render json: transactions end + def update + transaction = Transaction.find(params[:id]) + transaction.update_attributes(transaction_params) + render json: transaction + end + +protected + def transaction_params + params.require(:transaction).permit(:note) + end + end
Update an individual transaction (e.g. description)
diff --git a/config/environments/development.rb b/config/environments/development.rb index abc1234..def5678 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -16,5 +16,11 @@ # Don't care if the mailer can't send config.action_mailer.raise_delivery_errors = false -# Uncomment the following line if you're getting "A copy of XX has been removed from the module tree but is still active!" as it may help you: -# config.after_initialize { Dependencies.load_once_paths = Dependencies.load_once_paths.select { |path| (path =~ /app/).nil? } }+# Uncomment the following lines if you're getting +# "A copy of XX has been removed from the module tree but is still active!" +# or you want to develop a plugin and don't want to restart every time a change is made: +#config.after_initialize do +# ::ActiveSupport::Dependencies.load_once_paths = ::ActiveSupport::Dependencies.load_once_paths.select do |path| +# (path =~ /app/).nil? +# end +#end
Update the code that reloads plugin app directories to more robust code
diff --git a/config/environments/development.rb b/config/environments/development.rb index abc1234..def5678 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -38,4 +38,7 @@ # Raises error for missing translations # config.action_view.raise_on_missing_translations = true + + # Default URL options for the Devise mailer + config.action_mailer.default_url_options = { host: 'localhost', port: 3000 } end
Add default URL options for Devise mailer
diff --git a/config/initializers/clear_cache.rb b/config/initializers/clear_cache.rb index abc1234..def5678 100644 --- a/config/initializers/clear_cache.rb +++ b/config/initializers/clear_cache.rb @@ -1,3 +1,4 @@+`mkdir -p tmp/cache` # just in case this directory doesn't exist yet Rails.cache.clear Rails.logger.info "** Cleared the Rails cache." puts "** Cleared the Rails cache." if Rails.env.development?
Fix Heroku deployment build error
diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index abc1234..def5678 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -8,24 +8,3 @@ # inflect.irregular 'person', 'people' # inflect.uncountable %w( fish sheep ) # end - -# Mark "commits" as uncountable. -# -# Without this change, the routes -# -# resources :commit, only: [:show], constraints: {id: /[[:alnum:]]{6,40}/} -# resources :commits, only: [:show], constraints: {id: /.+/} -# -# would generate identical route helper methods (`project_commit_path`), resulting -# in one of them not getting a helper method at all. -# -# After this change, the helper methods are: -# -# project_commit_path(@project, @project.commit) -# # => "/gitlabhq/commit/bcf03b5de6c33f3869ef70d68cf06e679d1d7f9a -# -# project_commits_path(@project, 'stable/README.md') -# # => "/gitlabhq/commits/stable/README.md" -ActiveSupport::Inflector.inflections do |inflect| - inflect.uncountable %w(commits) -end
Remove inflector rule that makes commits uncountable Signed-off-by: Dmitriy Zaporozhets <[email protected]>
diff --git a/scripts/generate-coverage-report-index.rb b/scripts/generate-coverage-report-index.rb index abc1234..def5678 100644 --- a/scripts/generate-coverage-report-index.rb +++ b/scripts/generate-coverage-report-index.rb @@ -14,7 +14,11 @@ File.open(file, 'wb') { |f| f.write(content) } end -OUTPUT_FILE = ARGV.shift or raise 'Missing argument: OUTPUT_FILE' +unless ARGV.length == 1 + puts "Usage: #{$0} OUTPUT_FILE" + exit 1 +end +OUTPUT_FILE = ARGV.shift module_list_items = Dir.glob('*/target/pit-reports/*/index.html').sort. map { |module_index| module_list_item(module_index) }.
Print usage on wrong parameters
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 @@ -19,4 +19,5 @@ gem.add_dependency 'activesupport', '>= 3.0' gem.add_development_dependency 'rake', '>= 0.9' + gem.add_development_dependency 'rspec', '>= 2.10' end
Add rspec as a development dependency
diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/users_controller_spec.rb +++ b/spec/controllers/users_controller_spec.rb @@ -32,6 +32,21 @@ end end + describe "When Unsuccessful" do + it "redirects to login" do + post(:create, user: {name: nil, username: nil, password: nil }) + expect(response).to redirect_to login_path + end + + # it "sets a flash message welcoming the user" do + # post(:create, user: {name: nil, username: nil, password: nil }) + # expect(flash[:alert]).to have_content "You already exist, please login" + # end + + # end + end + + end
Add user create unsuccessful path test
diff --git a/spec/core_ext/object/space_object_spec.rb b/spec/core_ext/object/space_object_spec.rb index abc1234..def5678 100644 --- a/spec/core_ext/object/space_object_spec.rb +++ b/spec/core_ext/object/space_object_spec.rb @@ -0,0 +1,74 @@+require 'spec_helper' + +shared_examples_for 'a convertable object' do |object, expected| + it 'can be converted into a SpaceObject::Base via #to_space_object' do + expect(object.to_space_object).to eq(expected) + end +end + +shared_examples_for 'a convertable key' do |object, expected| + it 'can be converted into a SpaceObject::Base-compatible key via #to_space_key' do + expect(object.to_space_key).to eq(expected) + end +end + +shared_examples_for 'a convertable value' do |object, expected| + it 'can be converted into a SpaceObject::Base-compatible value via #to_space_value' do + expect(object.to_space_value).to eq(expected) + end +end + +shared_examples_for 'a convertable key or value' do |object, expected| + it_should_behave_like 'a convertable key', object, expected + it_should_behave_like 'a convertable value', object, expected +end + +describe Array do + it_should_behave_like 'a convertable object', ["foo", "bar"], SpaceObject.encode("0" => "foo", "1" => "bar") +end + +describe FalseClass do + it_should_behave_like 'a convertable key or value', false, 'false' +end + +describe Float do + f = 1.254583462345e10 + it_should_behave_like 'a convertable key or value', f, f.to_s +end + +describe Integer do + i = 12345678 + it_should_behave_like 'a convertable key or value', i, i.to_s +end + +describe Hash do + let(:hash) { {'foo' => 'bar'} } + it 'encodes itself using SpaceObject::Encoder' do + encoder = SpaceObject::Encoder.new(hash) + SpaceObject::Encoder.stub(:new).and_return encoder + + expect(hash.to_space_object).to be_a(SpaceObject::Base) + expect(SpaceObject::Encoder).to have_received(:new).with(hash) + end +end + +describe NilClass do + it_should_behave_like 'a convertable key or value', nil, '' +end + +describe Regexp do + regexp = /\w+,\s\d+/ + it_should_behave_like 'a convertable key or value', regexp, regexp.to_s +end + +describe String do + it_should_behave_like 'a convertable key or value', 'foobar', 'foobar' +end + +describe Symbol do + it_should_behave_like 'a convertable key or value', :foobar, 'foobar' +end + +describe TrueClass do + it_should_behave_like 'a convertable key or value', true, 'true' +end
Add tests for encodings of objects to Space keys, hashes, and objects.
diff --git a/beantool.gemspec b/beantool.gemspec index abc1234..def5678 100644 --- a/beantool.gemspec +++ b/beantool.gemspec @@ -20,7 +20,7 @@ gem.required_ruby_version = '~> 2.0' - gem.add_runtime_dependency 'beanstalk-client' + gem.add_runtime_dependency 'beaneater' gem.add_development_dependency 'bundler' gem.add_development_dependency 'rake'
Replace beanstalk-client dependency with beaneater
diff --git a/spec/serializers/payment_depot_serializer_spec.rb b/spec/serializers/payment_depot_serializer_spec.rb index abc1234..def5678 100644 --- a/spec/serializers/payment_depot_serializer_spec.rb +++ b/spec/serializers/payment_depot_serializer_spec.rb @@ -4,7 +4,11 @@ describe PaymentDepotSerializer do let(:payment_depot) do - build_stubbed(:payment_depot, address: "89s8x8", min_payment: 2.0) + build_stubbed(:payment_depot, { + address: "89s8x8", + min_payment: 2.0, + total_received_amount_cache: 19.0, + }) end let(:serializer) { described_class.new(payment_depot) } subject(:json) do @@ -12,12 +16,11 @@ end before do - expect(payment_depot).to receive(:total_received_amount) { 19.0 } expect(payment_depot).to receive(:min_payment_received?) { true } end its([:id]) { should eq payment_depot.id } - its([:total_received_amount]) { should eq 19.0 } + its([:total_received_amount]) { should eq "19.0" } its([:min_payment_received]) { should be_true } its([:address]) { should eq "89s8x8" } its([:min_payment]) { should eq "2.0" }
Set field to test that a string is returned
diff --git a/application.rb b/application.rb index abc1234..def5678 100644 --- a/application.rb +++ b/application.rb @@ -10,7 +10,6 @@ class Application < Sinatra::Base configure :production, :development do enable :logging - set :server, :puma end def initialize @@ -20,7 +19,14 @@ user: ENV['ANALYSIS_DB_USER'], password: ENV['ANALYSIS_DB_PW'] } - @db = PG.connect(connection_hash) + begin + @db = PG.connect(connection_hash) + rescue + puts 'Problem connecting to Postgres. Exiting.' + exit + end + + super end post '/segment' do
Exit on PG connection failure
diff --git a/services/importer/spec/acceptance/acceptance_helpers.rb b/services/importer/spec/acceptance/acceptance_helpers.rb index abc1234..def5678 100644 --- a/services/importer/spec/acceptance/acceptance_helpers.rb +++ b/services/importer/spec/acceptance/acceptance_helpers.rb @@ -1,11 +1,11 @@ module AcceptanceHelpers - def geometry_type_for(runner) + def geometry_type_for(runner, user) result = runner.results.first table_name = result.tables.first schema = result.schema - @db[%Q{ + user.in_database[%Q{ SELECT public.GeometryType(the_geom) FROM "#{schema}"."#{table_name}" }].first.fetch(:geometrytype)
Check geometry type directly in user db
diff --git a/test/controllers/users_controller_test.rb b/test/controllers/users_controller_test.rb index abc1234..def5678 100644 --- a/test/controllers/users_controller_test.rb +++ b/test/controllers/users_controller_test.rb @@ -36,6 +36,17 @@ assert_redirected_to my_profile_path end + test "should update user without password change" do + patch :update, id: @user, user: { email: @user.email, first_name: @user.first_name } + assert_redirected_to my_profile_path + end + + test "should not update user" do + patch :update, id: @user, user: { email: @user.email, first_name: @user.first_name, + password: "wrong" } + assert_template :edit + end + test "should destroy user" do assert_difference('User.count', -1) do delete :destroy, id: @user
Add test for failed password edit
diff --git a/test/tc_coverage.rb b/test/tc_coverage.rb index abc1234..def5678 100644 --- a/test/tc_coverage.rb +++ b/test/tc_coverage.rb @@ -17,9 +17,8 @@ class GratuitousBud < Test::Unit::TestCase def test_sigint pid = fork do - # XXX: There must be a better way to do this p = Nada.new - Thread.new { p.run_bg } + p.run_fg end sleep 1 Process.kill("INT", pid) @@ -27,9 +26,8 @@ end def test_sigterm pid = fork do - # XXX: There must be a better way to do this p = Nada.new - Thread.new { p.run_bg } + p.run_fg end sleep 1 Process.kill("TERM", pid)
Improve signal handling test case.
diff --git a/test/tc_live_cmn.rb b/test/tc_live_cmn.rb index abc1234..def5678 100644 --- a/test/tc_live_cmn.rb +++ b/test/tc_live_cmn.rb @@ -1,7 +1,12 @@ require 'rbconfig' module TestLiveCMN - unless Config::CONFIG['host_os'] =~ /mswin|mingw/ - def test_live_cmn + def test_live_cmn + # This test fails on windows because there is too much accumulated + # precision error from summing floats. A more sophisticated accumulation + # routine may solve this problem, however, from a speech recognition point + # of view it isn't a problem. Mean normalization needs to be done quickly + # and precision is probably of little benefit. + unless Config::CONFIG['host_os'] =~ /mswin|mingw/ flat_dct = IO.read('data/noyes/dct.dat').unpack 'g*' dct =[] 0.step flat_dct.size-13, 13 do |i|
Stop CMN test from failing on Windows.
diff --git a/test/test_consts.rb b/test/test_consts.rb index abc1234..def5678 100644 --- a/test/test_consts.rb +++ b/test/test_consts.rb @@ -9,6 +9,9 @@ end should "have the constants be the proper values" do + assert_equal Rutty::Consts::GENERAL_CONF_FILE, 'defaults.yaml' + assert_equal Rutty::Consts::NODES_CONF_FILE, 'nodes.yaml' + assert_equal Rutty::Consts::CONF_DIR, File.join(ENV['HOME'], '.rutty') assert_equal Rutty::Consts::GENERAL_CONF, File.join(Rutty::Consts::CONF_DIR, 'defaults.yaml') assert_equal Rutty::Consts::NODES_CONF, File.join(Rutty::Consts::CONF_DIR, 'nodes.yaml')
Add new assertions to Rutty::Consts test for new constants
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 @@ -28,7 +28,7 @@ @app = Risu::CLI::Application.new @app.load_config(config, true) @app.db_connect - @app.migrate(:down) if File.exist?("test_data/test.db") == true + File.delete(@file_name) if File.exist?("test_data/test.db") @app.migrate(:up) fixtures = Dir.glob(File.join('test', 'fixtures', '*.{yml,csv}'))
Delete test.db before the tests
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 @@ -2,3 +2,4 @@ require 'rex' require 'minitest/autorun' +require 'minitest/pride'
Add pride to minitest helper.
diff --git a/app/controllers/blog_controller.rb b/app/controllers/blog_controller.rb index abc1234..def5678 100644 --- a/app/controllers/blog_controller.rb +++ b/app/controllers/blog_controller.rb @@ -1,5 +1,4 @@ class BlogController < ApplicationController - layout 'application' before_filter :find_post, only: [:show] def index
Remove unneeded layout call in blog controller
diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index abc1234..def5678 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -1,7 +1,9 @@ class HomeController < ApplicationController def index @challenges = Challenge.opened - @posts = player_signed_in? ? Post.all : Post.public_only + @posts = + (player_signed_in? ? Post.all : Post.public_only) + .order(updated_at: :desc) end def rules
Order posts by updated date
diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index abc1234..def5678 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -1,19 +1,25 @@ class HomeController < ApplicationController + before_filter :load_asciicast + def show @title = "Share Your Terminal With No Fuss" - if home_asciicast_id = CFG['HOME_CAST_ID'] - asciicast = Asciicast.find(home_asciicast_id) - else - asciicast = Asciicast.order("created_at DESC").first - end - - if asciicast - @asciicast = AsciicastDecorator.new(asciicast) + if @asciicast + @asciicast = AsciicastDecorator.new(@asciicast) end @asciicasts = AsciicastDecorator.decorate_collection( Asciicast.order("created_at DESC").limit(9).includes(:user) ) end + + private + + def load_asciicast + if id = CFG['HOME_CAST_ID'] + @asciicast = Asciicast.find(id) + else + @asciicast = Asciicast.order("created_at DESC").first + end + end end
Load homepage asciicast in before_filter
diff --git a/app/serializers/firm_serializer.rb b/app/serializers/firm_serializer.rb index abc1234..def5678 100644 --- a/app/serializers/firm_serializer.rb +++ b/app/serializers/firm_serializer.rb @@ -9,6 +9,7 @@ :inheritance_tax_planning, :wills_and_probate, :other_advice_methods, + :advises_on_investments, :investment_sizes has_many :advisers @@ -45,6 +46,10 @@ object.other_advice_method_ids end + def advises_on_investments + object.investment_size_ids.any? + end + def investment_sizes object.investment_size_ids end
Index firms with a `advises_on_investments` flag.
diff --git a/test/integration/git_http_cloning_test.rb b/test/integration/git_http_cloning_test.rb index abc1234..def5678 100644 --- a/test/integration/git_http_cloning_test.rb +++ b/test/integration/git_http_cloning_test.rb @@ -2,20 +2,24 @@ class GitHttpCloningTest < ActionController::IntegrationTest context 'Request with git clone' do - setup {@request_uri = '/johans-project/johansprojectrepos.git/HEAD'} + setup do + @repository = repositories(:johans) + @request_uri = '/johans-project/johansprojectrepos.git/HEAD' + end should 'set X-Sendfile headers for subdomains allowing HTTP cloning' do ['git.gitorious.org','git.gitorious.local','git.foo.com'].each do |host| get @request_uri, {}, :host => host assert_response :success assert_not_nil(headers['X-Sendfile']) + assert_equal(File.join(GitoriousConfig['repository_base_path'], @repository.real_gitdir, "HEAD"), headers['X-Sendfile']) end end should 'not set X-Sendfile for hosts that do not allow HTTP cloning' do ['gitorious.local','foo.local'].each do |host| get @request_uri, {}, :host => host - assert_response 404 + assert_response :not_found assert_nil(headers['X-Sendfile']) end end
Make the git cloning metal test check that the actual filename returned is correct - not only that it is set
diff --git a/lib/caulfield.rb b/lib/caulfield.rb index abc1234..def5678 100644 --- a/lib/caulfield.rb +++ b/lib/caulfield.rb @@ -10,6 +10,6 @@ if defined?(Rails) && Rails.version >= '3.0.0' ActiveSupport.on_load :before_initialize do - Rails.configuration.middleware.use Caulfield::Middleware + Rails.configuration.middleware.insert_before ActionDispatch::Static, Caulfield::Middleware end end
Put Caulfield at the start of the middleware stack, so it can catch headers after they've been processed by ActionDispatch.
diff --git a/lib/datapipes.rb b/lib/datapipes.rb index abc1234..def5678 100644 --- a/lib/datapipes.rb +++ b/lib/datapipes.rb @@ -30,16 +30,16 @@ @source.pipe = @pipe runners = @source.run_all - consumer = run_comsumer + sink = run_sink runners.each(&:join) notify_resource_ending - consumer.join + sink.join end private - def run_comsumer + def run_sink Thread.new do loop do data = @pipe.pour_out
Change internal name: consumer -> sink
diff --git a/lib/metar/raw.rb b/lib/metar/raw.rb index abc1234..def5678 100644 --- a/lib/metar/raw.rb +++ b/lib/metar/raw.rb @@ -18,6 +18,7 @@ connection = Net::FTP.new('tgftp.nws.noaa.gov') connection.login connection.chdir('data/observations/metar/stations') + connection.passive = true connection end
Make sure FTP works behind firewalls.
diff --git a/apps/main/core/main/application.rb b/apps/main/core/main/application.rb index abc1234..def5678 100644 --- a/apps/main/core/main/application.rb +++ b/apps/main/core/main/application.rb @@ -1,6 +1,5 @@ require "rack/csrf" require "dry/web/application" -require "either_result_matcher/either_extensions" require_relative "container" require "roda_plugins"
Remove old either_result_matcher monkey-patch require
diff --git a/lib/tdx/stock.rb b/lib/tdx/stock.rb index abc1234..def5678 100644 --- a/lib/tdx/stock.rb +++ b/lib/tdx/stock.rb @@ -1,20 +1,31 @@ module Tdx class Stock def initialize(symbol) - @symbol = symbol + @stock_code, @exchange = parse_symbol(symbol) end def quotes(time_step = 240) case time_step when 5 - file = Data::File.open("data/#{@symbol}.5", 'rb') + file = Data::File.open("data/#{@exchange.to_s.downcase}#{@stock_code}.5", 'rb') @quotes = Parsers::FiveMinutes.parse(file) when 240 - file = Data::File.open("data/#{@symbol}.day", 'rb') + file = Data::File.open("data/#{@exchange.to_s.downcase}#{@stock_code}.day", 'rb') @quotes = Parsers::EoD.parse(file) else raise ArgumentError, 'Invalid time step' end end + + private + def parse_symbol(symbol) + stock_code, exchange = symbol.split('.') + exchange = exchange.to_s.upcase.to_sym + unless stock_code =~ /^\d{6}$/ and [:SZ, :SH].include? exchange + raise ArgumentError, 'Invalid stock symbol' + end + + return [stock_code, exchange] + end end end
Use Yahoo! Finance ticker symbol style
diff --git a/app/controllers/admin/financial_reports_controller.rb b/app/controllers/admin/financial_reports_controller.rb index abc1234..def5678 100644 --- a/app/controllers/admin/financial_reports_controller.rb +++ b/app/controllers/admin/financial_reports_controller.rb @@ -7,7 +7,7 @@ end def create - @financial_report = @organisation.financial_reports.build(params[:financial_report]) + @financial_report = @organisation.financial_reports.build(financial_report_params) if @financial_report.save redirect_to [:admin, @organisation, FinancialReport], notice: "Created Financial Report" else @@ -16,7 +16,7 @@ end def update - if @financial_report.update_attributes(params[:financial_report]) + if @financial_report.update_attributes(financial_report_params) redirect_to [:admin, @organisation, FinancialReport], notice: "Updated Financial Report" else render :edit, status: :bad_request @@ -36,4 +36,8 @@ def load_organisation @organisation ||= Organisation.find(params[:organisation_id]) end + + def financial_report_params + params.require(:financial_report).permit(:year, :spending, :funding) + end end
Add strong params for financial reports
diff --git a/app/controllers/electronics/electronics_controller.rb b/app/controllers/electronics/electronics_controller.rb index abc1234..def5678 100644 --- a/app/controllers/electronics/electronics_controller.rb +++ b/app/controllers/electronics/electronics_controller.rb @@ -2,7 +2,7 @@ def index add_breadcrumb "Electronics", electronics_root_path - @computers = Computer.where(slug: ["pancake", "quesadilla"]) + @computers = Computer.where(slug: ["pancake", "stroopwafel"]) device_cat_collection = Part.current_no_computer @device_groupings = device_cat_collection.groupings device_parts = device_cat_collection.parts
Change active computers listing in Index Electronics
diff --git a/db/seeds/modules/gobierto_plans/seeds.rb b/db/seeds/modules/gobierto_plans/seeds.rb index abc1234..def5678 100644 --- a/db/seeds/modules/gobierto_plans/seeds.rb +++ b/db/seeds/modules/gobierto_plans/seeds.rb @@ -4,9 +4,6 @@ class Recipe def self.run(site) - # Create sdg vocabulary - return if site.custom_fields.vocabulary_options.where(uid: "sdgs").exists? - # Create vocabulary vocabulary = site.vocabularies.find_or_initialize_by(slug: "sdgs-vocabulary") if vocabulary.new_record? @@ -14,29 +11,14 @@ vocabulary.save end + return if vocabulary.terms.present? + # Load terms import_form = GobiertoAdmin::GobiertoCommon::VocabularyTermsImportForm.new( vocabulary: vocabulary, csv_file: Rails.root.join("db/seeds/modules/gobierto_plans/sdgs_seeds.csv") ) import_form.save - - # Create custom field - class_name = "GobiertoPlans::Node" - custom_field = site.custom_fields.vocabulary_options.create( - uid: "sdgs", - name_translations: { - ca: "Objectius de Desenvolupament Sostenible", - en: "Sustainable Development Goals", - es: "Objetivos de Desarrollo Sostenible" - }, - class_name: class_name, - options: { - configuration: { vocabulary_type: "multiple_select" }, - vocabulary_id: vocabulary.id - } - ) - custom_field.update_attribute(:position, (site.custom_fields.where(class_name: class_name).maximum(:position) || 0) + 1) end end end
Change plans module seed to only import SDGs vocabulary but not create custom field
diff --git a/make-sponsors.rb b/make-sponsors.rb index abc1234..def5678 100644 --- a/make-sponsors.rb +++ b/make-sponsors.rb @@ -0,0 +1,19 @@+require "yaml" +print "Enter the event in YYYY-city format: " +cityname = gets.chomp +config = YAML.load_file("data/events/#{cityname}.yml") +sponsors = config['sponsors'] +sponsors.each {|s| + if File.exist?("data/sponsors/#{s['id']}.yml") + puts "The file for #{s['id']} totally exists already" + else + puts "I need to make a file for #{s['id']}" + puts "What is the sponsor URL?" + sponsor_url = gets.chomp + sponsorfile = File.open("data/sponsors/#{s['id']}.yml", "w") + sponsorfile.write "name: #{s['id']}\n" + sponsorfile.write "url: #{sponsor_url}\n" + sponsorfile.close + puts "It will be data/sponsors/#{s['id']}.yml" + end +}
Create script for generating sponsor files This ruby script basically reads in a city config file and creates the sponsor file associated with it. It will NOT create the images, naturally, but this will make it somewhat easier. Former-commit-id: 4c9503f6a12b3c0eac0eb1e4610acd20acce7c8c
diff --git a/app/models/qernel/merit_facade/curtailment_adapter.rb b/app/models/qernel/merit_facade/curtailment_adapter.rb index abc1234..def5678 100644 --- a/app/models/qernel/merit_facade/curtailment_adapter.rb +++ b/app/models/qernel/merit_facade/curtailment_adapter.rb @@ -9,11 +9,13 @@ super input_link = target_api.converter.input(@context.carrier).links.first + demand = participant.production(:mj) - # Figure out the output efficiency of the network; curtailment needs to - # be reduced by exactly this amount to prevent unwanted import. - efficiency = input_link.output.conversion - demand = participant.production(:mj) * efficiency + if @context.carrier == :electricity + # Figure out the output efficiency of the network; curtailment needs + # to be reduced by exactly this amount to prevent unwanted import. + demand *= input_link.output.conversion + end if input_link.link_type == :inversed_flexible # We need to override the calculation of an inversed flexible link
Correct deficit of unused steam in merit order CurtailmentAdapter adjusts the demand assigned for electricity networks in order to prevent unwanted import from occurring. This compensation is now required with the heat network where there is no dispatchable import. Corrects an errenous demand assiged to the edge between the backup burner and the heat network.
diff --git a/KSPAutomaticHeightCalculationTableCellView.podspec b/KSPAutomaticHeightCalculationTableCellView.podspec index abc1234..def5678 100644 --- a/KSPAutomaticHeightCalculationTableCellView.podspec +++ b/KSPAutomaticHeightCalculationTableCellView.podspec @@ -16,9 +16,9 @@ spec.summary = 'A useful superclass for a custom view-based NSTableViews cell.' - spec.platform = :osx, "10.7" + spec.platform = :osx, "10.8" - spec.osx.deployment_target = "10.7" + spec.osx.deployment_target = "10.8" spec.requires_arc = true
Raise the deployment target to 10.8 because of a used NSNib method.
diff --git a/bin/geocode_cita.rb b/bin/geocode_cita.rb index abc1234..def5678 100644 --- a/bin/geocode_cita.rb +++ b/bin/geocode_cita.rb @@ -6,14 +6,15 @@ locations = [] -# "REGION","DELIVERY BUREAU","PRIMARY CONTACT","POSTAL ADDRESS","Phone number" +# "Pension Wise Delivery Centre ","Pension Wise Email ","Pension Wise Phone Number ","Pension Wise Contact Address" CSV.foreach('cita.csv', headers: true, return_headers: false) do |row| - address = row.fields[3].gsub(/\n/, ', ').strip - phone = row.fields.last.strip + region = row.fields.first.strip + address = row.fields.last.strip.gsub(/\n/, ', ') + phone = row.fields[2].strip lat, lng = Geocoder.coordinates(address) locations << { - title: 'Citizens Advice', + title: "#{region} Citizens Advice", address: address, phone: phone, lat: lat,
Update CitA CSV parsing script
diff --git a/ohm-contrib.gemspec b/ohm-contrib.gemspec index abc1234..def5678 100644 --- a/ohm-contrib.gemspec +++ b/ohm-contrib.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = "ohm-contrib" - s.version = "1.0.0.rc4" + s.version = "1.0.0.rc5" s.summary = %{A collection of decoupled drop-in modules for Ohm.} s.description = %{Includes a couple of core functions such as callbacks, timestamping, typecasting and lots of generic validation routines.} s.author = "Cyril David" @@ -22,7 +22,7 @@ s.rubyforge_project = "ohm-contrib" s.has_rdoc = false - s.add_dependency "ohm", "1.0.0.rc3" + s.add_dependency "ohm", "1.0.0.rc4" s.add_development_dependency "cutest" s.add_development_dependency "redis"
Bump to 1.0.0.rc5: Point to ohm 1.0.0.rc4.
diff --git a/sanitize-rails.gemspec b/sanitize-rails.gemspec index abc1234..def5678 100644 --- a/sanitize-rails.gemspec +++ b/sanitize-rails.gemspec @@ -8,8 +8,8 @@ s.name = "sanitize-rails" s.version = Sanitize::Rails::VERSION s.date = "2014-03-14" - s.authors = ["Marcello Barnaba", "Damien Wilson"] - s.email = ["[email protected]", "[email protected]"] + s.authors = ["Marcello Barnaba", "Damien Wilson", "Fabio Napoleoni"] + s.email = ["[email protected]", "[email protected]", "[email protected]"] s.homepage = "http://github.com/vjt/sanitize-rails" s.summary = "A sanitizer bridge for Rails applications" s.license = "MIT"
:star: Add @fabn to the authors list
diff --git a/sass-timestamp.gemspec b/sass-timestamp.gemspec index abc1234..def5678 100644 --- a/sass-timestamp.gemspec +++ b/sass-timestamp.gemspec @@ -1,13 +1,13 @@ Gem::Specification.new do |s| s.name = %q{sass-timestamp} - s.version = "0.0.1.alpha.1" + s.version = "0.0.1" s.date = %q{2014-08-12} s.license = 'MIT' s.summary = %q{SASS compile timestamp function} s.description = "Sass function for addimg timestamps to compiled CSS." s.authors = ["madastro"] s.email = '[email protected]' - s.homepage = 'http://madastro.com' + s.homepage = 'https://github.com/madastro/sass-timestamp' s.files = ["lib/sass-timestamp.rb"] s.require_paths = ["lib"]
Change homepage link to github source
diff --git a/config/environments/development.rb b/config/environments/development.rb index abc1234..def5678 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -9,8 +9,11 @@ # since you don't have to restart the web server when you make code changes. config.cache_classes = false - # Do not eager load code on boot. - config.eager_load = false + # Eager load code on boot. This eager loads most of Rails and + # your application in memory, allowing both threaded web servers + # and those relying on copy on write to perform better. + # Rake tasks automatically ignore this option for performance. + config.eager_load = true # Show full error reports and disable caching. config.consider_all_requests_local = true
BAU: Fix for translations being on a separate thread In dev env the eager_load is set to false which causes the app the hang when it looses the reference to the TransactionTranslationResponse class. This is a quick fix.
diff --git a/app/helpers/user_impersonate/application_helper.rb b/app/helpers/user_impersonate/application_helper.rb index abc1234..def5678 100644 --- a/app/helpers/user_impersonate/application_helper.rb +++ b/app/helpers/user_impersonate/application_helper.rb @@ -5,7 +5,7 @@ staff_finder_method = config_value(UserImpersonate::Engine.config, :staff_finder, 'find').to_sym staff_class_name = config_value(UserImpersonate::Engine.config, :staff_class, 'User') staff_class = staff_class_name.constantize - @staff_user ||= staff_class.send(staff_finder_method, session[:staff_user_id]) + @staff_user ||= staff_class.unscoped.send(staff_finder_method, session[:staff_user_id]) end private
Add unscoped call for users
diff --git a/config/initializers/load_resque.rb b/config/initializers/load_resque.rb index abc1234..def5678 100644 --- a/config/initializers/load_resque.rb +++ b/config/initializers/load_resque.rb @@ -7,4 +7,41 @@ Dir[Rails.root.join("lib/resque/*.rb")].each {|f| require f} Resque.redis = "#{Cartodb.config[:redis]['host']}:#{Cartodb.config[:redis]['port']}" -Resque::Metrics.watch_fork +Resque.metric_logger = Logger.new("#{Rails.root}/log/resque_metrics.log") + +Resque::Metrics.on_job_complete do |job_class, queue, time| + Resque.metric_logger.info( + {:event => :job_complete, + :job_class => job_class, + :queue => queue, + :time => time}.to_json + ) +end + +Resque::Metrics.on_job_enqueue do |job_class, queue, time| + Resque.metric_logger.info( + {:event => :job_enqueue, + :job_class => job_class, + :queue => queue, + :time => time}.to_json + ) +end + +Resque::Metrics.on_job_fork do |job_class, queue| + Resque.metric_logger.info( + {:event => :job_fork, + :job_class => job_class, + :queue => queue, + :time => time}.to_json + ) +end + +Resque::Metrics.on_job_failure do |job_class, queue| + Resque.metric_logger.info( + {:event => :job_failure, + :job_class => job_class, + :queue => queue, + :time => time}.to_json + ) +end +
Use custom logger to extract metrics instead of statsd logger
diff --git a/config/initializers/door_status_manager.rb b/config/initializers/door_status_manager.rb index abc1234..def5678 100644 --- a/config/initializers/door_status_manager.rb +++ b/config/initializers/door_status_manager.rb @@ -1,6 +1,6 @@ # Pesho instance for door status updates Rails.application.config.door_status_manager = ActiveSupport::OrderedOptions.new -Rails.application.config.door_status_manager.host = '::1' +Rails.application.config.door_status_manager.host = '[::1]' Rails.application.config.door_status_manager.url = "http://#{Rails.application.config.door_status_manager.host}" Rails.application.config.door_status_manager.timeout = 1 Rails.application.config.door_status_manager.cache_lifetime = 1.minute
Make the default door status manager URI a valid one
diff --git a/cookbooks/postgresql/attributes/default.rb b/cookbooks/postgresql/attributes/default.rb index abc1234..def5678 100644 --- a/cookbooks/postgresql/attributes/default.rb +++ b/cookbooks/postgresql/attributes/default.rb @@ -1,7 +1,7 @@ include_attribute 'travis_build_environment' -default['postgresql']['default_version'] = '9.1' -default['postgresql']['alternate_versions'] = %w(9.2 9.3 9.4 9.5) +default['postgresql']['default_version'] = '9.3' +default['postgresql']['alternate_versions'] = %w(9.1 9.2 9.4 9.5 9.6) default['postgresql']['enabled'] = true # is default instance started on machine boot?
Add 9.6 to postgresql alternate versions and bump the default from 9.1 => 9.3
diff --git a/cookbooks/lib/features/git_spec.rb b/cookbooks/lib/features/git_spec.rb index abc1234..def5678 100644 --- a/cookbooks/lib/features/git_spec.rb +++ b/cookbooks/lib/features/git_spec.rb @@ -10,11 +10,11 @@ its(:exit_status) { should eq 0 } end - describe command('git config user.name'), dev: true do + describe command('git config user.name'), dev: true, precise: false do its(:stdout) { should match(/travis/i) } end - describe command('git config user.email'), dev: true do + describe command('git config user.email'), dev: true, precise: false do its(:stdout) { should match(/travis@example\.org/) } end
Tag git config specs to be skipped on precise until the behavior can be backported
diff --git a/spec/functionality_spec.rb b/spec/functionality_spec.rb index abc1234..def5678 100644 --- a/spec/functionality_spec.rb +++ b/spec/functionality_spec.rb @@ -13,7 +13,7 @@ it 'raises an error for missing files' do expect { subject.inform('nonexist') - }.to raise_error(/failed to open/) + }.to raise_error(/no file opened/) end it 'works with an mov file' do @@ -25,10 +25,10 @@ it 'works' do subject.open(mov_file) do subject.streams.each do |s| - puts "== #{s.stream_type} ==" + expect(s.stream_type).to be_a(Symbol) s.class.supported_attributes.each do |a| - puts "#{a} : #{s.send(a)}" + expect(s.respond_to?(a)).to be true end end end
Fix specs, do not output the metadata.
diff --git a/spec/lib/allen/dsl_spec.rb b/spec/lib/allen/dsl_spec.rb index abc1234..def5678 100644 --- a/spec/lib/allen/dsl_spec.rb +++ b/spec/lib/allen/dsl_spec.rb @@ -20,13 +20,18 @@ end it "can configure projects" do - proj = project "Rhino" do + proj1 = project "Rhino" do compile true cache { false } end - proj.settings.compile.should == true - proj.settings.cache.should == false + proj2 = project "Rupert" do + compressor :uglify + end + + proj1.settings.compile.should == true + proj1.settings.cache.should == false + proj2.settings.compressor.should == :uglify end end
Add an additional project as a sanity check
diff --git a/spec/sequel_spec_helper.rb b/spec/sequel_spec_helper.rb index abc1234..def5678 100644 --- a/spec/sequel_spec_helper.rb +++ b/spec/sequel_spec_helper.rb @@ -27,6 +27,7 @@ def self.model_setup(db, models) models.each do |name, (table, associations)| klass = Class.new(Sequel::Model(db[table])) + Object.const_set(name, klass) klass.class_eval do if associations associations.each do |type, assoc, opts| @@ -34,7 +35,6 @@ end end end - Object.const_set(name, klass) end end end
Set model top level constant earlier in spec, fixing association issues
diff --git a/compat/helper.rb b/compat/helper.rb index abc1234..def5678 100644 --- a/compat/helper.rb +++ b/compat/helper.rb @@ -24,6 +24,9 @@ class Test::Unit::TestCase include Sinatra::Test + + PASSTHROUGH_EXCEPTIONS = [] unless const_defined?(:PASSTHROUGH_EXCEPTIONS) + def setup @app = lambda { |env| Sinatra::Application.call(env) } end
Fix mocha puking all over itself under 1.9
diff --git a/config/application.rb b/config/application.rb index abc1234..def5678 100644 --- a/config/application.rb +++ b/config/application.rb @@ -20,6 +20,6 @@ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] # config.i18n.default_locale = :de - config.assets.precompile += %w( ckeditor/* ) + config.assets.precompile += %w( ckeditor/**/* ) end end
Update ckeditor assets precompile directive CKEditor is not working, hoping this will fix it.
diff --git a/omniauth.gemspec b/omniauth.gemspec index abc1234..def5678 100644 --- a/omniauth.gemspec +++ b/omniauth.gemspec @@ -17,6 +17,7 @@ spec.name = 'omniauth' spec.require_paths = %w(lib) spec.required_rubygems_version = '>= 1.3.5' + spec.required_ruby_version = '>= 2.1.9' spec.summary = spec.description spec.version = OmniAuth::VERSION end
Update required Ruby version in gemspec
diff --git a/spec/models/ci/bridge_spec.rb b/spec/models/ci/bridge_spec.rb index abc1234..def5678 100644 --- a/spec/models/ci/bridge_spec.rb +++ b/spec/models/ci/bridge_spec.rb @@ -25,22 +25,16 @@ describe '#scoped_variables_hash' do it 'returns a hash representing variables' do - expect(bridge.scoped_variables_hash.keys).to eq %w[ - CI GITLAB_CI GITLAB_FEATURES CI_SERVER_NAME - CI_SERVER_VERSION CI_SERVER_VERSION_MAJOR - CI_SERVER_VERSION_MINOR CI_SERVER_VERSION_PATCH - CI_SERVER_REVISION CI_JOB_NAME CI_JOB_STAGE - CI_COMMIT_SHA CI_COMMIT_SHORT_SHA CI_COMMIT_BEFORE_SHA - CI_COMMIT_REF_NAME CI_COMMIT_REF_SLUG CI_NODE_TOTAL - CI_BUILD_REF CI_BUILD_BEFORE_SHA CI_BUILD_REF_NAME - CI_BUILD_REF_SLUG CI_BUILD_NAME CI_BUILD_STAGE + variables = %w[ + CI_JOB_NAME CI_JOB_STAGE CI_COMMIT_SHA CI_COMMIT_SHORT_SHA + CI_COMMIT_BEFORE_SHA CI_COMMIT_REF_NAME CI_COMMIT_REF_SLUG CI_PROJECT_ID CI_PROJECT_NAME CI_PROJECT_PATH - CI_PROJECT_PATH_SLUG CI_PROJECT_NAMESPACE CI_PROJECT_URL - CI_PROJECT_VISIBILITY CI_PAGES_DOMAIN CI_PAGES_URL - CI_REGISTRY CI_REGISTRY_IMAGE CI_API_V4_URL - CI_PIPELINE_IID CI_CONFIG_PATH CI_PIPELINE_SOURCE - CI_COMMIT_MESSAGE CI_COMMIT_TITLE CI_COMMIT_DESCRIPTION + CI_PROJECT_PATH_SLUG CI_PROJECT_NAMESPACE CI_PIPELINE_IID + CI_CONFIG_PATH CI_PIPELINE_SOURCE CI_COMMIT_MESSAGE + CI_COMMIT_TITLE CI_COMMIT_DESCRIPTION ] + + expect(bridge.scoped_variables_hash.keys).to include(*variables) end end end
Fix CI/CD bridge variables unit test
diff --git a/spec/rdkafka/bindings_spec.rb b/spec/rdkafka/bindings_spec.rb index abc1234..def5678 100644 --- a/spec/rdkafka/bindings_spec.rb +++ b/spec/rdkafka/bindings_spec.rb @@ -5,9 +5,58 @@ expect(Rdkafka::Bindings.ffi_libraries.map(&:name).first).to include "librdkafka" end + describe ".lib_extension" do + it "should know the lib extension for darwin" do + expect(Gem::Platform.local).to receive(:os).and_return("darwin-aaa") + expect(Rdkafka::Bindings.lib_extension).to eq "dylib" + end + + it "should know the lib extension for linux" do + expect(Gem::Platform.local).to receive(:os).and_return("linux") + expect(Rdkafka::Bindings.lib_extension).to eq "so" + end + end + it "should successfully call librdkafka" do expect { Rdkafka::Bindings.rd_kafka_conf_new }.not_to raise_error end + + describe "log callback" do + let(:log) { StringIO.new } + before do + Rdkafka::Config.logger = Logger.new(log) + end + + it "should log fatal messages" do + Rdkafka::Bindings::LogCallback.call(nil, 0, nil, "log line") + expect(log.string).to include "FATAL -- : rdkafka: log line" + end + + it "should log error messages" do + Rdkafka::Bindings::LogCallback.call(nil, 3, nil, "log line") + expect(log.string).to include "ERROR -- : rdkafka: log line" + end + + it "should log warning messages" do + Rdkafka::Bindings::LogCallback.call(nil, 4, nil, "log line") + expect(log.string).to include "WARN -- : rdkafka: log line" + end + + it "should log info messages" do + Rdkafka::Bindings::LogCallback.call(nil, 5, nil, "log line") + expect(log.string).to include "INFO -- : rdkafka: log line" + end + + it "should log debug messages" do + Rdkafka::Bindings::LogCallback.call(nil, 7, nil, "log line") + expect(log.string).to include "DEBUG -- : rdkafka: log line" + end + + it "should log unknown messages" do + Rdkafka::Bindings::LogCallback.call(nil, 100, nil, "log line") + expect(log.string).to include "ANY -- : rdkafka: log line" + end + end end
Add specs for extension and log callback in bindings
diff --git a/sprockets-redirect.gemspec b/sprockets-redirect.gemspec index abc1234..def5678 100644 --- a/sprockets-redirect.gemspec +++ b/sprockets-redirect.gemspec @@ -28,6 +28,7 @@ s.add_development_dependency 'bundler' s.add_development_dependency 'rake' s.add_development_dependency 'rack-test' + s.add_development_dependency 'rails' s.authors = ["Prem Sichanugrist"] s.email = "[email protected]"
Add Rails as development dependency
diff --git a/lib/tasks/auto_annotate_models.rake b/lib/tasks/auto_annotate_models.rake index abc1234..def5678 100644 --- a/lib/tasks/auto_annotate_models.rake +++ b/lib/tasks/auto_annotate_models.rake @@ -19,7 +19,7 @@ 'exclude_tests' => 'false', 'exclude_fixtures' => 'false', 'exclude_factories' => 'false', - 'ignore_model_sub_dir' => 'false', + 'ignore_model_sub_dir' => 'true', 'skip_on_db_migrate' => 'false', 'format_bare' => 'true', 'format_rdoc' => 'false',
Stop scanning subdirectories under app/models.
diff --git a/lib/zensana/models/asana/project.rb b/lib/zensana/models/asana/project.rb index abc1234..def5678 100644 --- a/lib/zensana/models/asana/project.rb +++ b/lib/zensana/models/asana/project.rb @@ -47,7 +47,7 @@ end def fetch_tasks(id) - task_list(id).map { |t| Zensana::Task.new(t['id']) } + task_list(id).map { |t| Zensana::Asana::Task.new(t['id']) } end def task_list(id)
Fix reference to task object
diff --git a/spec/cookie_spec.rb b/spec/cookie_spec.rb index abc1234..def5678 100644 --- a/spec/cookie_spec.rb +++ b/spec/cookie_spec.rb @@ -10,6 +10,8 @@ expect(data["cat"]).to eq("dog") end + # The "new" cookie string is being updated with additional criteria, thereby making a string comparison worthless, + # This makes this test unusable unless I come with a different approach. GO GO TDD! xit "can generate Set-Cookie headers" do string = CIPHER.encrypt("foo=bar; cat=dog") cookie = Cookie.new("FirstServerCookie=#{Base64.encode64(string)}")
Write comment explaining why test is probably failing
diff --git a/spec/sartre_spec.rb b/spec/sartre_spec.rb index abc1234..def5678 100644 --- a/spec/sartre_spec.rb +++ b/spec/sartre_spec.rb @@ -0,0 +1,36 @@+require 'bundler/setup' +require 'rspec' +require 'sartre' + +describe Sartre do + subject do + class MyObject + attr_accessor :property + + def attribute + true + end + + def name + 'an object' + end + end + MyObject.new + end + + it "responds to existential methods" do + subject.attribute?.should be_true + end + + it "converts all values to boolean" do + subject.name?.should be_true + end + + it "returns false when a method returns nil" do + subject.property?.should be_false + end + + it "returns false when a method doesn't exist" do + subject.nonexistant?.should be_false + end +end
Write tests for extenssts for extension
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -14,8 +14,14 @@ # Omit warnings from output config.log_level = :fatal + + config.before(:suite) do + ChefSpec::Coverage.filters << File.join(config.cookbook_path, 'mesos') + end end require 'support/source_installation' require 'support/mesosphere_installation' require 'support/setup_context' + +at_exit { ChefSpec::Coverage.report! }
Add chefspec coverage w/ fancy filter
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -22,9 +22,12 @@ options = Net::SSH::Config.for(host) -options[:user] ||= Etc.getlogin +set :host, options[:host_name] || host -set :host, options[:host_name] || host +# Get HostName and User value from Env Vars if available +options[:host_name] ||= ENV['TARGET_HOST_NAME'] +options[:user] ||= ENV['TARGET_USER_NAME'] + set :ssh_options, options # Disable sudo
Enable setting of HostName and User via environment variables
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,6 @@+require 'coveralls' +Coveralls.wear! + require 'right_hook' require 'right_hook/app' require 'right_hook/authenticated_client' @@ -10,9 +13,6 @@ require 'webmock/rspec' require 'rack/test' -require 'coveralls' -Coveralls.wear! - RSpec.configure do |c| c.include Rack::Test::Methods c.include RightHook::SpecHelpers
Put `Coveralls.wear!` before app code is required That's what the docs say to do, anyway. https://coveralls.io/docs/ruby
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -27,7 +27,7 @@ # FakeWeb.register_uri( # :post, -# "https://api.channeladvisor.com/ChannelAdvisorAPI/v5/OrderService.asmx", +# "https://api.channeladvisor.com/ChannelAdvisorAPI/v6/OrderService.asmx", # response # ) # end
Update FakeWeb URI to ChannelAdvisor V6 API
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -14,6 +14,10 @@ require 'queueing_rabbit' RSpec.configure do |config| + config.before(:each) { + QueueingRabbit.drop_connection + } + QueueingRabbit.configure do |qr| qr.amqp_uri = "amqp://guest:guest@localhost:5672" qr.amqp_exchange_name = "queueing_rabbit_test"
Drop connection before each example.
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -44,7 +44,7 @@ if ::ActiveRecord::VERSION::STRING >= '4.1.0' require 'minitest' include Minitest::Assertions - def assertions; @assertions || 0; end + def assertions; @assertions ||= 0; end def assertions= value; @assertions = value; end else require 'test/unit/assertions'
Fix uninitialized instance variable warning
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -8,8 +8,6 @@ Dir[File.expand_path("../support/**/*.rb", __FILE__)].each {|f| require f} PROJECT_ROOT = File.expand_path(File.join(__FILE__, "../../")) SPEC_ROOT = File.expand_path(File.join(__FILE__, "../")) - -require 'pry-debugger' # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration RSpec.configure do |config|
Remove missed require of pry-debugger
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,2 +1,4 @@ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require 'sncf_api' +require 'pry' +require 'pry-byebug'
Enable pry dbg binding into guard/rspec
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,5 +1,19 @@ require 'bundler/setup' +require 'coveralls' +Coveralls.wear! + require 'space2underscore' +require 'simplecov' + +SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[ + SimpleCov::Formatter::HTMLFormatter, + Coveralls::SimpleCov::Formatter +] + +SimpleCov.start do + add_filter '/vendor/' +end + Bundler.setup RSpec.configure do |config|
Configure of gems for coverage
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -2,7 +2,6 @@ Coveralls.wear! RSpec.configure do |config| - config.treat_symbols_as_metadata_keys_with_true_values = true config.run_all_when_everything_filtered = true config.filter_run :focus
Remove redundant RSpec config option treat_symbols_as_metadata_keys_with_true_values is now always true (and setting it to false has no effect).
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,5 @@ require File.dirname(__FILE__) + "/../lib/integrity" require "rubygems" require "spec" + +DataMapper.setup(:default, "sqlite3::memory:")
Use an in-memory sqlite3 database for testing
diff --git a/lib/spiderfw/controller/request.rb b/lib/spiderfw/controller/request.rb index abc1234..def5678 100644 --- a/lib/spiderfw/controller/request.rb +++ b/lib/spiderfw/controller/request.rb @@ -24,7 +24,7 @@ Spider::Logger.debug("REQUEST:") Spider::Logger.debug(env) @env = env - @locale = Locale.current[0] + @locale = Spider.locale @misc = {} @params = {} @action = ""
Use Spider.locale instead of Locale.current[0] to avoid errors on Windows
diff --git a/config/deploy.rb b/config/deploy.rb index abc1234..def5678 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -5,7 +5,7 @@ set :repo_url, 'https://github.com/anniecodes/annie.codes.git' set :user, "deploy" -set :rbenv_ruby, "2.5.3" +set :rbenv_ruby, "2.6.0" # Default value for :linked_files is [] # append :linked_files, 'config/database.yml', 'config/secrets.yml'
Deploy to the correct ruby version 2.6.0
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,6 @@ Rails.application.routes.draw do + + root to: 'items#index' resources :schools, only: [:show]
Change root to be the items search view
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -2,7 +2,7 @@ scope module: 'sprangular' do root to: 'home#index' - scope defaults: {format: :json} do + scope '/api', defaults: {format: :json} do post 'facebook/fetch' resources :taxonomies, only: :index
Add /api to controller path
diff --git a/lib/devise/models/strengthened.rb b/lib/devise/models/strengthened.rb index abc1234..def5678 100644 --- a/lib/devise/models/strengthened.rb +++ b/lib/devise/models/strengthened.rb @@ -11,8 +11,13 @@ protected + MINIMUM_ENTROPY = 20 + def strong_enough_password? - self.errors.add :password, :insufficient_entropy unless PassphraseEntropy.of(password) >= 20 + entropy = PassphraseEntropy.of(password) + if entropy <= MINIMUM_ENTROPY + self.errors.add :password, "not strong enough. It scored #{entropy}. It must score at least #{MINIMUM_ENTROPY}." + end end module ClassMethods
Add feedback for password strength
diff --git a/lib/geocoder/lookups/pickpoint.rb b/lib/geocoder/lookups/pickpoint.rb index abc1234..def5678 100644 --- a/lib/geocoder/lookups/pickpoint.rb +++ b/lib/geocoder/lookups/pickpoint.rb @@ -7,8 +7,8 @@ "Pickpoint" end - def use_ssl? - true + def supported_protocols + [:https] end def required_api_key_parts
Implement supported_protocols rather than use_ssl?. This is a better way to force HTTPS.
diff --git a/lib/github/repository_importer.rb b/lib/github/repository_importer.rb index abc1234..def5678 100644 --- a/lib/github/repository_importer.rb +++ b/lib/github/repository_importer.rb @@ -1,7 +1,7 @@ module Github class RepositoryImporter - API_REQUEST_INTERVAL = 0.02 - MAX_IMPORT_COUNT = 30 + API_REQUEST_INTERVAL = 1 + MAX_IMPORT_COUNT = 10 FETCH_ATTRIBUTES = %i[ id name
Decrease repository import frequency because it finished
diff --git a/lib/lobbyist/v2/scotty_setting.rb b/lib/lobbyist/v2/scotty_setting.rb index abc1234..def5678 100644 --- a/lib/lobbyist/v2/scotty_setting.rb +++ b/lib/lobbyist/v2/scotty_setting.rb @@ -5,7 +5,7 @@ attr_accessor :id, :company_id, :days, :time attr_accessor :upload_type, :system_enabled, :use_closed_invoices, :access_token, :access_secret attr_accessor :access_data, :link_established, :last_run_date, :authentication_date, :importer_class_name - attr_accessor :created_at, :updated_at + attr_accessor :created_at, :updated_at, :account_name def self.create(params) create_from_response(post("/v2/scotty_settings.json", {scotty_setting: params}))
CA-4261: Add new field as accessor
diff --git a/app/controllers/observations_controller.rb b/app/controllers/observations_controller.rb index abc1234..def5678 100644 --- a/app/controllers/observations_controller.rb +++ b/app/controllers/observations_controller.rb @@ -1,10 +1,6 @@ # frozen_string_literal: true class ObservationsController < ApplicationController - # These need to be moved into the files where they are actually used. - require "find" - require "set" - include Index include Show include NewAndCreate
Delete requires for "find" and "set" in main Obs Ctrlr file
diff --git a/app/presenters/clockface/jobs_presenter.rb b/app/presenters/clockface/jobs_presenter.rb index abc1234..def5678 100644 --- a/app/presenters/clockface/jobs_presenter.rb +++ b/app/presenters/clockface/jobs_presenter.rb @@ -33,7 +33,7 @@ def last_run_at if job.last_run_at job.last_run_at. - in_time_zone(Clockface::Engine.config.clockface.time_zone). + in_time_zone(time_zone_for_display). strftime(I18n.t("datetime.formats.international")) end end @@ -43,5 +43,10 @@ def job __getobj__ end + + def time_zone_for_display + tz = Clockface::Engine.config.clockface.time_zone + ActiveSupport::TimeZone::MAPPING.key?(tz) ? tz : "UTC" + end end end
Validate time_zone before using it