diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/week-4/defining-variables.rb b/week-4/defining-variables.rb index abc1234..def5678 100644 --- a/week-4/defining-variables.rb +++ b/week-4/defining-variables.rb @@ -1,6 +1,11 @@-first_name='Sabrina' -last_name='Unrein' -age=22 +first_name = "Sabrina" +last_name = "Unrein" +age = 22 + +p first_name +p last_name +p age + describe 'first_name' do it "is defined as a local variable" do
Refactor in order to avoid errors
diff --git a/test/integration/user/custom_session_test.rb b/test/integration/user/custom_session_test.rb index abc1234..def5678 100644 --- a/test/integration/user/custom_session_test.rb +++ b/test/integration/user/custom_session_test.rb @@ -0,0 +1,87 @@+# frozen_string_literal: true + +require "test_helper" + +class User::CustomSessionTest < ActionDispatch::IntegrationTest + + def site_without_auth_strategy + @site ||= sites('madrid') + end + + def site_with_auth_strategy + @site_with_auth_strategy ||= sites('cortegada') + end + + def admin + @admin ||= gobierto_admin_admins(:nick) + end + + def user + @user ||= users('dennis') + end + + def activate_null_strategy_for_site(site) + with_signed_in_admin(admin) do + visit edit_admin_site_path(site) + within ".auth-module-check-boxes" do + check "Null Strategy" + end + + within ".widget_save" do + choose "Published" + end + click_button "Update" + end + end + + def test_site_normal_session_without_strategy + with_current_site(site_without_auth_strategy) do + visit new_user_sessions_path + assert has_content?("Are you already registered? Log in") + + fill_in :user_session_email, with: user.email + fill_in :user_session_password, with: "gobierto" + click_on "Log in" + + assert has_message?("Signed in successfully") + + within "header .user_links" do + click_on "Sign out" + end + + assert has_message?("Signed out successfully") + end + end + + def test_site_custom_session_with_strategy + with_current_site(site_with_auth_strategy) do + visit new_user_sessions_path + + assert has_content?("Sign in (Null strategy)") + + fill_in :user_session_email, with: user.email + fill_in :user_session_password, with: "gobierto" + click_on "Submit" + + refute has_message?("Signed in successfully") + + assert has_message?("Invalid data received. The session could not be created") + end + end + + def test_site_configuration_strategy_change + with_current_site(site_without_auth_strategy) do + visit new_user_sessions_path + assert has_content?("Are you already registered? Log in") + end + + activate_null_strategy_for_site(site_without_auth_strategy) + reloaded_site = Site.find(site_without_auth_strategy.id) + + with_current_site(reloaded_site) do + visit new_user_sessions_path + assert has_content?("Sign in (Null strategy)") + end + end + +end
Add integration tests for signup with auth strategies
diff --git a/lib/troo/cli/main.rb b/lib/troo/cli/main.rb index abc1234..def5678 100644 --- a/lib/troo/cli/main.rb +++ b/lib/troo/cli/main.rb @@ -25,8 +25,8 @@ say "troo #{Troo::VERSION}" end - desc "show [board|list|card|comment] <id>", - "Show the board, list, card or comment with <id>." + desc "show [board|list|card|comments] <id>", + "Show the board, list, card with <id>. Also, show all comments for card with <id>." subcommand :show, CLI::Show desc "add [board|list|card|comment] <id>",
Update help text for showing comments.
diff --git a/config.rb b/config.rb index abc1234..def5678 100644 --- a/config.rb +++ b/config.rb @@ -1,3 +1,7 @@ module BotConfig - BASE_DIR = '/home/will/Programming/neanb0t' + BASE_DIR = '/home/will/Programming/neanb0t' + YO_API_TOKEN = '' + + GIPHY_API_VERSION = 'v1' + GIPHY_API_KEY = 'dc6zaTOxFJmzC' end
Add Yo and Giphy API stuff
diff --git a/config.ru b/config.ru index abc1234..def5678 100644 --- a/config.ru +++ b/config.ru @@ -29,7 +29,7 @@ end use Pebbles::Cors do |domain| - domain = Domain.find_by_name(domain) + domain = Domain.resolve_from_host_name(domain) domain ? domain.realm.domains.map(&:name) : [] end
Use Domain.resolve_from_host_name to get domain of origin
diff --git a/lib/yubioath/list.rb b/lib/yubioath/list.rb index abc1234..def5678 100644 --- a/lib/yubioath/list.rb +++ b/lib/yubioath/list.rb @@ -13,14 +13,14 @@ uint8 :p2, value: 0x00 end - class ListEntry < BinData::Primitive - uint8 :name_list_tag, assert: 0x72 + class Code < BinData::Record + uint8 :name_tag uint8 :name_length - string :name, read_length: -> { name_length - 1 } + string :name, read_length: :name_length end class Response < BinData::Record - array :codes, type: :list_entry + array :codes, type: :code, read_until: :eof end end end
Refactor the List response definition
diff --git a/scrapinghub.gemspec b/scrapinghub.gemspec index abc1234..def5678 100644 --- a/scrapinghub.gemspec +++ b/scrapinghub.gemspec @@ -8,11 +8,10 @@ s.email = "abe@abevoelker.com" s.homepage = "https://github.com/abevoelker/scrapinghub-client" s.summary = %q{Ruby client for Scrapinghub API} - s.description = %q{Ruby client for Scrapinghub API} + s.description = s.summary s.license = "MIT" s.require_paths = ["lib"] - s.require_paths = [ "lib" ] s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- {spec}/*`.split("\n")
Remove extraneous require_paths from gemspec
diff --git a/config.ru b/config.ru index abc1234..def5678 100644 --- a/config.ru +++ b/config.ru @@ -2,4 +2,6 @@ require ::File.expand_path('../config/environment', __FILE__) -run Rails.application +map (ENV['RAILS_RELATIVE_URL_ROOT'] || '/') do + run Rails.application +end
Revert "run app out of directory" This reverts commit 61453543da7dcbaadfb734aafd863172e6268af5.
diff --git a/roles/grifon.rb b/roles/grifon.rb index abc1234..def5678 100644 --- a/roles/grifon.rb +++ b/roles/grifon.rb @@ -15,7 +15,7 @@ :allow => ["2a00:5884::8"] }, :networking => { - :nameservers => ["2a00:5884::7"], + :nameservers => ["2a00:5884::7", "8.8.8.8", "8.8.4.4"], :roles => { :external => { :zone => "grf"
Add some IPv4 nameservers for norbert
diff --git a/test/cookbooks/test/metadata.rb b/test/cookbooks/test/metadata.rb index abc1234..def5678 100644 --- a/test/cookbooks/test/metadata.rb +++ b/test/cookbooks/test/metadata.rb @@ -1,6 +1,6 @@ name 'test' version '0.1.0' -depends 'openssh' +depends 'openssh', '>= 2.8' depends 'fail2ban' depends 'rsyslog', '> 4.0'
Make sure we have the new openssh in testing This is necessary for opensuse Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
diff --git a/config.ru b/config.ru index abc1234..def5678 100644 --- a/config.ru +++ b/config.ru @@ -1,8 +1,13 @@ path = File.dirname(__FILE__) require path + '/dashboards' + +Dotenv.load +if ENV['DASHBOARD_AUTH_TOKEN'] + set :auth_token, ENV['DASHBOARD_AUTH_TOKEN'] +end map Sinatra::Application.assets_prefix do run Sinatra::Application.sprockets end -run Sinatra::Application+run Sinatra::Application
Add an auth token to trigger dashboard reloads
diff --git a/AlamofireObjectMapper.podspec b/AlamofireObjectMapper.podspec index abc1234..def5678 100644 --- a/AlamofireObjectMapper.podspec +++ b/AlamofireObjectMapper.podspec @@ -16,5 +16,5 @@ s.requires_arc = 'true' s.source_files = 'AlamofireObjectMapper/**/*.swift' s.dependency 'Alamofire', '~> 4.0' - s.dependency 'ObjectMapper', '~> 1.0' + s.dependency 'ObjectMapper', '~> 2.0' end
Use ObjectMapper 2.0 for Swift 3
diff --git a/app/controllers/contact_us/contacts_controller.rb b/app/controllers/contact_us/contacts_controller.rb index abc1234..def5678 100644 --- a/app/controllers/contact_us/contacts_controller.rb +++ b/app/controllers/contact_us/contacts_controller.rb @@ -4,7 +4,8 @@ def create @contact = ContactUs::Contact.new(permitted_attributes) begin - if verify_recaptcha(model: @contact) && @contact.save + verify_recaptcha = (ENV['ENABLE_RERECAPTCHA'] || false).to_b && ENV['RECAPTCHA_SITE_KEY'].present? ? verify_recaptcha(model: @contact) : true + if verify_recaptcha && @contact.save redirect_to('/', :notice => t('admin.contact_us.notices.success')) else flash[:error] = t('admin.contact_us.notices.error')
Add condition for verify recatcha in contact form
diff --git a/bottles_of_beer.rb b/bottles_of_beer.rb index abc1234..def5678 100644 --- a/bottles_of_beer.rb +++ b/bottles_of_beer.rb @@ -1,4 +1,4 @@-bottles = 99 +bottles = 15 #or 99, if you want 100 verses of the song until bottles == 0 puts "#{bottles} bottles of beer on the wall!"
Change default value of bottles of beer
diff --git a/circonus.gemspec b/circonus.gemspec index abc1234..def5678 100644 --- a/circonus.gemspec +++ b/circonus.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = "circonus" - s.version = "3.6.0" + s.version = "3.6.1" s.license = 'MIT' s.email = "david-vv@nicklay.com" s.homepage = "https://github.com/venturaville/circonus-api" @@ -9,7 +9,7 @@ s.files = Dir['lib/**/*.rb'] + Dir['bin/*'] + Dir['examples/*.rb'] s.description = "Wrapper and CLI for Circonus API" s.bindir = "bin" - s.executables = %w{ circonus-add-http-check circonus-add-composite circonus-cli circonus-delete-host circonus-list-checkbundle circonus-list-tags} + s.executables = %w{ circonus-add-http-check circonus-add-composite circonus-cli circonus-delete-host circonus-list-checkbundle circonus-list-tags circonus-list-brokers circonus-list-contactgroups } %w{ rest-client ripl yajl-ruby }.each do |d| s.add_dependency d end
Add list-contactgroups/brokers to bin list
diff --git a/app/views/api/v1/places/index.json.rabl b/app/views/api/v1/places/index.json.rabl index abc1234..def5678 100644 --- a/app/views/api/v1/places/index.json.rabl +++ b/app/views/api/v1/places/index.json.rabl @@ -4,6 +4,10 @@ :accepts_new_members, :is_established, :description attributes :related_places_count +child :ownerships do + attributes :user_id +end + # farm attributes actually, not place attributes. # but included here for map tooltip display attributes :vegetable_products, :animal_products, :beverages
Add (some) ownership info to index result.
diff --git a/examples/upload_statement.rb b/examples/upload_statement.rb index abc1234..def5678 100644 --- a/examples/upload_statement.rb +++ b/examples/upload_statement.rb @@ -0,0 +1,43 @@+ARGV.each do |file| + if !file || !File.exist?(file) + $stderr.puts "usage: #{$0} FILE1 [FILE2 [FILE3 ...]]" + exit(1) + end +end + +require File.dirname(__FILE__) + '/common' + +ARGV.each do |file| + puts "======= #{file} =======" + + # TODO <brian@wesabe.com> 2009-01-28: Support uploads to non-existing accounts. + # This is a little silly, but currently the upload system requires the + # account id (last4), account type, and balance (QIF only). These are things + # in the OFX file, so why do we make clients handle these things? *sigh* + begin + puts + + # QIF doesn't have the last4 or balance + wesabe.accounts.each_with_index do |account, i| + puts "#{i+1}. #{account.name}" + end + # puts "#{wesabe.accounts.size}. Other (new account)" + + idx = readline("Which account should I upload this to? ").to_i + if (1..wesabe.accounts.size).include?(idx) + upload = wesabe.accounts[idx-1].new_upload + elsif idx == wesabe.accounts.size+1 # Other + # uh. not yet + end + + if upload.nil? + $stderr.puts "Cat got your tongue?" + retry + end + end + + upload.statement = File.read(file) + upload.upload! + puts "======= #{file} [#{upload.status}] =======" + puts +end
Add a sample to upload files from the command-line.
diff --git a/app/controllers/section_attachments_controller.rb b/app/controllers/section_attachments_controller.rb index abc1234..def5678 100644 --- a/app/controllers/section_attachments_controller.rb +++ b/app/controllers/section_attachments_controller.rb @@ -57,10 +57,4 @@ }) end end - -private - - def repository - ScopedManualRepository.new(current_user.manual_records) - end end
Remove unused repository method on SectionAttachmentsController
diff --git a/app/models/resource.rb b/app/models/resource.rb index abc1234..def5678 100644 --- a/app/models/resource.rb +++ b/app/models/resource.rb @@ -27,18 +27,16 @@ Booking.joins(:events).where(events: { resource: self }) end - #TODO See how to get access to the event status constant. - def pending_bookings_count - Booking.joins(:events).where(events: { status: 0, resource: self }).count + Booking.joins(:events).where(events: { status: Event::statuses[:pending], resource: self }).count end def occurring_bookings_count - Booking.joins(:events).where(events: { status: 1, resource: self }).count + Booking.joins(:events).where(events: { status: Event::statuses[:occurring], resource: self }).count end def expired_bookings_count - Booking.joins(:events).where(events: { status: 2, resource: self }).count + Booking.joins(:events).where(events: { status: Event::statuses[:expired], resource: self }).count end def name_prefixed_with_resource_type
Refactor to add event status constant.
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 @@ -16,9 +16,11 @@ require 'timecop' require 'tty-progressbar' -StringIO.undef_method :tty? -StringIO.define_method :tty? do - true +class StringIO + undef_method :tty? + def tty? + true + end end RSpec.configure do |config|
Change to obey method visiblity
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,7 +1,14 @@ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) + + require 'simplecov' SimpleCov.start # require 'emony' +if RSpec.configuration.instance_variable_get(:@files_or_directories_to_run) == %w(spec) + Dir["#{__dir__}/../lib/**/*.rb"].map do |x| + require x + end +end
Load all lib files for more accurate coverage only when it's going to run entire spec files (`bundle exec 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,3 +1,5 @@+# TODO switch docker vs vagrant + require 'serverspec' require 'net/ssh' require 'lib/docker' @@ -9,7 +11,6 @@ RSpec.configure do |c| c.before :all do - # TODO switch docker vs vagrant d = Docker.new c.host = d.ssh_host opts = Net::SSH::Config.for(c.host)
[tdd] Move TODOs to the beginning of files
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 @@ -16,15 +16,18 @@ def event_happened(params={}) event_name = params[:event] || event event_time = params[:at] - event_count = params[:times] || 1 + event_count = params[:times] - event_count.times do - params = default_params.dup - if event_time - params.merge!(:timestamp => event_time.to_i) - end - post "/track/#{event_name}", params + params = default_params.dup + if event_time + params.merge!(:timestamp => event_time.to_i) end + if event_count + params.merge!(:quantity => event_count) + end + + post "/track/#{event_name}", params + end def freeze_time
Speed up tests by ~90%. Make the helper method #event_happened much more efficient when the event count is > 1. Prior to this change, event_happened(:times => N) would make N POST requests to the app; now, it makes just one and sets the :quantity parameter to N. This slowness occurred because #event_happened predates the :quantity parameter, so repeated requests was the only way to go.
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 @@ -3,12 +3,13 @@ require 'rspec' require 'webmock/rspec' require 'vcr' -require 'isbm_adaptor' if ENV['COVERAGE'] == 'on' require 'coveralls' Coveralls.wear! end + +require 'isbm_adaptor' settings = YAML.load_file(File.expand_path(File.dirname(__FILE__)) + '/../config/settings.yml')['test'] ENDPOINTS = settings['endpoints']
Fix require order for accurate test 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 @@ -4,9 +4,12 @@ require 'spec' require 'merb-core' require 'merb-gen' -require 'generators/cucumber' + require 'templater/spec/helpers' +__dir__ = File.dirname(__FILE__) +require File.join(__dir__, "..", "lib", "generators", "cucumber") +require File.join(__dir__, "..", "lib", "generators", "feature") Merb.disable(:initfile) Spec::Runner.configure do |config|
Use local copy when running specs
diff --git a/phinms/src/test/ruby/test_phinms_insert.rb b/phinms/src/test/ruby/test_phinms_insert.rb index abc1234..def5678 100644 --- a/phinms/src/test/ruby/test_phinms_insert.rb +++ b/phinms/src/test/ruby/test_phinms_insert.rb @@ -0,0 +1,22 @@+require 'sequel' +require 'csv' + +input = File.read ARGV[0] +messages = CSV.parse(input, headers: true) + +row_hash = messages[0].to_h + +lower_row = {} + +row_hash.each_pair do |k, v| + lower_row[k.downcase] = v +end + +lower_row.delete('payloadbinarycontent') +lower_row['action'] ||= 'test' +lower_row['encryption'] ||= 'none' +lower_row['localfilename'] ||= 'v2message.txt' +lower_row['service'] ||= 'service' + +DB = Sequel.connect(adapter: 'postgres', host: 'localhost', database: 'sdp_db', user: 'sdp_dbq', password: 'bob') +DB[:message_inq].insert(lower_row)
Test script to insert a row into a mock PHIN MS
diff --git a/config/puma.rb b/config/puma.rb index abc1234..def5678 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -1,12 +1,12 @@-workers ENV['SERVER_WORKER_COUNT'] +workers ENV['SERVER_WORKER_COUNT'] || 2 -threads_count = ENV['SERVER_MAX_THREADS_COUNT'] +threads_count = ENV['SERVER_MAX_THREADS_COUNT'] || 5 threads threads_count, threads_count preload_app! -port ENV['SERVER_PORT'] -environment ENV['RACK_ENV'] +port ENV['SERVER_PORT'] || 3000 +environment ENV['RACK_ENV'] || 'development' on_worker_boot do Sequel.connect(ENV['DATABASE_URL'])
Add default values to Puma configuration
diff --git a/spec/factories/sales_pages.rb b/spec/factories/sales_pages.rb index abc1234..def5678 100644 --- a/spec/factories/sales_pages.rb +++ b/spec/factories/sales_pages.rb @@ -2,13 +2,14 @@ factory :sales_page do club - benefit1 { Faker::Lorem.words(rand(5) + 1).join " " } - benefit2 { Faker::Lorem.words(rand(5) + 1).join " " } - benefit3 { Faker::Lorem.words(rand(5) + 1).join " " } - details { Faker::Lorem.words(rand(5) + 1).join " " } - call_to_action { Faker::Lorem.words(rand(3) + 1).join " " } - heading { Faker::Lorem.words(rand(3) + 3).join " " } - sub_heading { Faker::Lorem.words(rand(5) + 3).join " " } + benefit1 { Faker::Lorem.words(rand(5) + 1).join " " } + benefit2 { Faker::Lorem.words(rand(5) + 1).join " " } + benefit3 { Faker::Lorem.words(rand(5) + 1).join " " } + details { Faker::Lorem.words(rand(5) + 1).join " " } + call_to_action { Faker::Lorem.words(rand(3) + 1).join " " } + call_details { Faker::Lorem.words(rand(22) + 1).join " " } + heading { Faker::Lorem.words(rand(3) + 3).join " " } + sub_heading { Faker::Lorem.words(rand(5) + 3).join " " } video { "http://www.ifsimply.com/" } end end
Update SalesPage Factory for call_details Add the call_details attribute to the SalesPage model factory.
diff --git a/spec/features/sign_in_spec.rb b/spec/features/sign_in_spec.rb index abc1234..def5678 100644 --- a/spec/features/sign_in_spec.rb +++ b/spec/features/sign_in_spec.rb @@ -2,29 +2,72 @@ describe 'Signing in' do context 'when visiting a protected page' do + let(:protected_path) { edit_user_registration_path(user) } + context 'with valid credentials' do + before do + stub_g5_omniauth(user) + visit protected_path + end + context 'when user exists locally' do - it 'should sign in the user successfully' - it 'should redirect the user to the requested path' - it 'should display name of the current user' - it 'should display the email of the current user' + let(:user) { create(:user) } + + it 'should sign in the user successfully' do + expect(page).to have_content('Signed in successfully.') + end + + it 'should redirect the user to the requested path' do + expect(current_path).to eq(protected_path) + end end context 'when user does not exist locally' do - it 'should redirect the user to the registration page' - it 'should display an informative message' - it 'should prefill the Email field' + let(:user) { build(:user) } + + it 'should display an informative message' do + expect(page).to have_content('You must sign up before continuing.') + end + + it 'should redirect the user to the registration page' do + expect(current_path).to eq(new_user_registration_path) + end + + it 'should prefill the Email field' do + expect(find_field('Email').value).to eq(user.email) + end end end context 'with invalid credentials' do - it 'should display an error' + before do + stub_g5_invalid_credentials + visit protected_path + end + + let(:user) { create(:user) } + + it 'should display an error' do + expect(page).to have_content('Invalid email or password.') + end end end context 'when clicking a login link' do - it 'should sign in the user successfully' - it 'should redirect the user to the root path' - it 'should display the name of the current user' + before do + visit root_path + stub_g5_omniauth(user) + click_link 'Login' + end + + let(:user) { create(:user) } + + it 'should sign in the user successfully' do + expect(page).to have_content('Signed in successfully.') + end + + it 'should redirect the user to the root path' do + expect(current_path).to eq(root_path) + end end end
Implement failing feature specs around sign in
diff --git a/spec/fpm/package/cpan_spec.rb b/spec/fpm/package/cpan_spec.rb index abc1234..def5678 100644 --- a/spec/fpm/package/cpan_spec.rb +++ b/spec/fpm/package/cpan_spec.rb @@ -32,6 +32,8 @@ context "given a distribution without a META.* file" do it "should package IPC::Session" do + # IPC::Session fails 'make test' + subject.attributes[:cpan_test?] = false subject.input("IPC::Session") end end
Set :cpan_test? attribute to false for IPC::Session rspec test
diff --git a/spec/support/worker_macros.rb b/spec/support/worker_macros.rb index abc1234..def5678 100644 --- a/spec/support/worker_macros.rb +++ b/spec/support/worker_macros.rb @@ -21,7 +21,7 @@ def use_clojure_factories before :each do # Blocking workers skip the mock check - Backend.blocking_worker "circle.backend.build.test-utils/ensure-test-db" + Backend.blocking_worker "circle.test-utils/ensure-test-db" end end end
Use the new test-utils name from Rails.
diff --git a/features/support/env.rb b/features/support/env.rb index abc1234..def5678 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -1,9 +1,9 @@ require 'fileutils' -require 'selenium-webdriver' require 'capybara' require 'capybara/cucumber' require 'capybara/dsl' +require 'capybara/webkit' require 'rspec/expectations' require 'geo_magic/remote' @@ -11,7 +11,7 @@ Capybara.run_server = false Capybara.default_wait_time = 30 -Capybara.default_driver = :selenium +Capybara.default_driver = :webkit # browser = Selenium::WebDriver.for :firefox
Use the webkit driver to run all tests.
diff --git a/features/support/vcr.rb b/features/support/vcr.rb index abc1234..def5678 100644 --- a/features/support/vcr.rb +++ b/features/support/vcr.rb @@ -10,6 +10,7 @@ c.filter_sensitive_data("<KEY>") do |interaction| interaction.response.body.match(/SID=[a-z0-9_-]+[\s]+LSID=[a-z0-9_-]+[\s]+Auth=([a-z0-9_-]+)/i) end + c.ignore_localhost = true c.default_cassette_options = { :record => :once } c.cassette_library_dir = 'fixtures/vcr_cassettes' c.hook_into :webmock
Set VCR to ignore localhost requests (breaks Poltergeist stuff)
diff --git a/FastEasyMapping.podspec b/FastEasyMapping.podspec index abc1234..def5678 100644 --- a/FastEasyMapping.podspec +++ b/FastEasyMapping.podspec @@ -13,4 +13,5 @@ spec.frameworks = 'CoreData' spec.source_files = 'FastEasyMapping/Source/**/*.{h,m}' + spec.private_header_files = 'FastEasyMapping/Source/Extensions/**/*.h' end
Add private header files to podspec
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index abc1234..def5678 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,5 +1,3 @@-require 'htmlentities' - module ApplicationHelper def page_title(artefact, publication=nil) if publication @@ -49,12 +47,4 @@ path += "?edition=#{opts[:edition]}" if opts[:edition] path end - - # Convert entities in the form &ldquo; to numeric form (&#8220;) - # This is needed for inserting html snippets into xml documents (e.g. atom feeds) as - # XML only defines 5 named entities and any others are invalid. - def numericise_html_entities(string) - coder = HTMLEntities.new - string.gsub(/&[#0-9a-zA-Z]+;/) {|match| coder.encode(coder.decode(match), :decimal) } - end end
Remove old helper that's now unused.
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index abc1234..def5678 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -14,7 +14,7 @@ end end end - host + host || admin? end
Correct `event_host?` to also include admins.
diff --git a/config/initializers/registration.rb b/config/initializers/registration.rb index abc1234..def5678 100644 --- a/config/initializers/registration.rb +++ b/config/initializers/registration.rb @@ -3,15 +3,15 @@ routes.url_helpers.new_payment_path(contribution_id: contribution) end -total_with_fees = ->(value) do +value_with_fees = ->(value) do Neighborly::Balanced::Creditcard::Fee.new(value).total end begin - PaymentEngines.register(name: 'balanced-creditcard', - locale: 'en', - total_with_fees: total_with_fees, - review_path: review_path) + PaymentEngines.register(name: 'balanced-creditcard', + locale: 'en', + value_with_fees: value_with_fees, + review_path: review_path) rescue Exception => e puts "Error while registering payment engine: #{e}" end
Rename fees block to :value_with_fees
diff --git a/config/initializers/secret_token.rb b/config/initializers/secret_token.rb index abc1234..def5678 100644 --- a/config/initializers/secret_token.rb +++ b/config/initializers/secret_token.rb @@ -9,4 +9,4 @@ # Make sure your secret_key_base is kept private # if you're sharing your code publicly. -PaperSearchApi::Application.config.secret_key_base = 'd410eb964ae4915ce2b72ef8036c0a3b9b84974d55d68c29099f721504396f32e877d8c3dfb654bd5fdfc627026ca288afa84206b76cc9ebaf446191a6a335b4' +PaperSearchApi::Application.config.secret_key_base = ENV['SECRET_KEY_BASE']
Set Application.config.secret_key_base from an environment variable This is necessary for us to open source the API repo
diff --git a/Casks/crashplan.rb b/Casks/crashplan.rb index abc1234..def5678 100644 --- a/Casks/crashplan.rb +++ b/Casks/crashplan.rb @@ -2,7 +2,7 @@ url 'http://download.crashplan.com/installs/mac/install/CrashPlan/CrashPlan_3.6.3_Mac.dmg' homepage 'http://www.crashplan.com/' version '3.6.3' - sha256 '50a15332c779d9dd6e9a3e4e20360f3baebafee93362e32e4c6621a3cc501f1d' + sha256 '85d49c6742e390a24f0a0931d3c2cbb9ab077a1cd5361d980992ba2908acbd23' install 'Install CrashPlan.pkg' uninstall( :script => 'Uninstall.app/Contents/Resources/uninstall.sh',
Fix CrashPlan checksum for v3.6.3
diff --git a/lib/condensation.rb b/lib/condensation.rb index abc1234..def5678 100644 --- a/lib/condensation.rb +++ b/lib/condensation.rb @@ -6,6 +6,7 @@ module Condensation FILTERS = [ Filters::Default, + Filters::Hyperlink, Filters::ReplaceInnerHTML ]
Add hyperlink filter to list
diff --git a/lib/ffi-rxs/libc.rb b/lib/ffi-rxs/libc.rb index abc1234..def5678 100644 --- a/lib/ffi-rxs/libc.rb +++ b/lib/ffi-rxs/libc.rb @@ -1,11 +1,9 @@ # encoding: utf-8 -require 'ffi' - module LibC - extend FFI::Library + extend ::FFI::Library # figures out the correct libc for each platform including Windows - library = ffi_lib(FFI::Library::LIBC).first + library = ffi_lib(::FFI::Library::LIBC).first # Size_t not working properly on Windows find_type(:size_t) rescue typedef(:ulong, :size_t)
Revert "Further Travis CI investigation" This reverts commit c25c82e503d34521cfd795e847d1844564b191ba.
diff --git a/lib/googtaculous.rb b/lib/googtaculous.rb index abc1234..def5678 100644 --- a/lib/googtaculous.rb +++ b/lib/googtaculous.rb @@ -1,19 +1,29 @@ module StrictlyUntyped - module Googtaculous - - GOOGLE_PATHS = { - 'prototype' => 'http://ajax.googleapis.com/ajax/libs/prototype/1.6.0.2/prototype.js', - 'effects' => 'http://ajax.googleapis.com/ajax/libs/scriptaculous/1.8.1/effects.js', - 'dragdrop' => 'http://ajax.googleapis.com/ajax/libs/scriptaculous/1.8.1/dragdrop.js', - 'controls' => 'http://ajax.googleapis.com/ajax/libs/scriptaculous/1.8.1/controls.js' - } - + module Googtaculous def self.included(base) - base.send :alias_method_chain, :path_to_javascript, :google unless ActionController::Base.consider_all_requests_local + base.send(:alias_method_chain, :path_to_javascript, :google) unless ActionController::Base.consider_all_requests_local end - + def path_to_javascript_with_google(source) - GOOGLE_PATHS[source] || path_to_javascript_without_google(source) + google_path(source) || path_to_javascript_without_google(source) end + + private + GOOGLE_PATHS = { + 'prototype' => 'prototype/1.6.0.2/prototype.js', + 'effects' => 'scriptaculous/1.8.1/effects.js', + 'dragdrop' => 'scriptaculous/1.8.1/dragdrop.js', + 'controls' => 'scriptaculous/1.8.1/controls.js' + } + + def google_path(source) + if GOOGLE_PATHS.include? source + [@controller.request.protocol, google_ajax_lib_root, GOOGLE_PATHS[source]].join + end + end + + def google_ajax_lib_root + "ajax.googleapis.com/ajax/libs/" + end end end
Use google's new https support if request is ssl
diff --git a/lib/skeleton/app.rb b/lib/skeleton/app.rb index abc1234..def5678 100644 --- a/lib/skeleton/app.rb +++ b/lib/skeleton/app.rb @@ -6,7 +6,7 @@ class App < Sinatra::Base set :root, File.dirname(__FILE__) - register Sinatra::AdvancedRoutes + register Sinatra::Export register Sinatra::AssetPack register Sinatra::Reloader if development?
Update usage of Sinatra::Export 1.0.0
diff --git a/lib/vagrant-hostmanager/action/update_all.rb b/lib/vagrant-hostmanager/action/update_all.rb index abc1234..def5678 100644 --- a/lib/vagrant-hostmanager/action/update_all.rb +++ b/lib/vagrant-hostmanager/action/update_all.rb @@ -21,7 +21,7 @@ return @app.call(env) if !@machine.id && env[:machine_action] == :destroy # check config to see if the hosts file should be update automatically - return @app.call(env) unless @machine.config.hostmanager.enabled? + return @app.call(env) unless @global_env.config_global.hostmanager.enabled? @logger.info 'Updating /etc/hosts file automatically' @app.call(env)
Check global.enabled instead of machine.enabled update_all.rb checks if @machine.config.hostmanager.enabled is set to true. The default value of @enabled is set to false by config.rb. If the Vagrantfile has a global value of true for enabled but it sets vm specific hostmanager options, such as when specifying hostmanager.aliases, then the @machine.config.hostmanager.enabled will default to false and hostmanager will not think it is enabled. Check @global_env.config_global.hostmanager.enabled instead.
diff --git a/db/migrate/20150809200412_change_seq_field_in_questions_table_from_float_to_decimal.rb b/db/migrate/20150809200412_change_seq_field_in_questions_table_from_float_to_decimal.rb index abc1234..def5678 100644 --- a/db/migrate/20150809200412_change_seq_field_in_questions_table_from_float_to_decimal.rb +++ b/db/migrate/20150809200412_change_seq_field_in_questions_table_from_float_to_decimal.rb @@ -0,0 +1,9 @@+class ChangeSeqFieldInQuestionsTableFromFloatToDecimal < ActiveRecord::Migration + def self.up + change_column :questions, :seq, :decimal, precision: 6, scale: 2 + end + + def self.down + change_column :questions, :seq, :float + end +end
Change seq field in questions table from float to decimal
diff --git a/lib/todotxt/todo.rb b/lib/todotxt/todo.rb index abc1234..def5678 100644 --- a/lib/todotxt/todo.rb +++ b/lib/todotxt/todo.rb @@ -36,13 +36,19 @@ return end - priority_string = new_priority ? "(#{new_priority.upcase}) " : "" + if new_priority + new_priority = new_priority.upcase + end + + priority_string = new_priority ? "(#{new_priority}) " : "" if priority @text.gsub! PRIORITY_REGEX, priority_string else @text = "#{priority_string}#{text}".strip end + + @priority = new_priority end def append appended_text=""
Correct priority functionality on the model
diff --git a/daemons.gemspec b/daemons.gemspec index abc1234..def5678 100644 --- a/daemons.gemspec +++ b/daemons.gemspec @@ -24,8 +24,7 @@ s.files = [ "Rakefile", "Releases", - "TODO", - "README", + "README.md", "LICENSE", "setup.rb", "lib/*.rb",
Update gemspec removing TODO and renaming README.md
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,6 +1,9 @@-ActionController::Routing::Routes.draw do |map| +# Rails 3 depreciates ActionController::Routing::Routes +routes = (Rails.respond_to?(:application) ? Rails.application.routes : ActionController::Routing::Routes) + +routes.draw do |map| if Authorization::activate_authorization_rules_browser? - map.resources :authorization_rules, :only => [:index], + map.resources :authorization_rules, :only => [:index], :collection => {:graph => :get, :change => :get, :suggest_change => :get} map.resources :authorization_usages, :only => :index end
Use Rails 3's prefered interface while maintaining backwards compatibility.
diff --git a/knife-cloudformation.gemspec b/knife-cloudformation.gemspec index abc1234..def5678 100644 --- a/knife-cloudformation.gemspec +++ b/knife-cloudformation.gemspec @@ -13,5 +13,6 @@ s.add_dependency 'fog', '~> 1.15' s.add_dependency 'net-sftp' s.add_dependency 'attribute_struct', '~> 0.1.6' + s.add_dependency 'redis-objects' s.files = Dir['**/*'] end
Include required dependency for caching support
diff --git a/smtpapi.gemspec b/smtpapi.gemspec index abc1234..def5678 100644 --- a/smtpapi.gemspec +++ b/smtpapi.gemspec @@ -18,6 +18,7 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] + spec.add_dependency "json" spec.add_development_dependency "bundler", "~> 1.5" spec.add_development_dependency "rake" end
Edit .gemspec for dependency json gem
diff --git a/db/migrate/20160215004455_create_reviews_table.rb b/db/migrate/20160215004455_create_reviews_table.rb index abc1234..def5678 100644 --- a/db/migrate/20160215004455_create_reviews_table.rb +++ b/db/migrate/20160215004455_create_reviews_table.rb @@ -1,14 +1,15 @@ class CreateReviewsTable < ActiveRecord::Migration def change - create_table :reviews_tables do |t| - t.integer :rating - t.text :comment - t.string :nct_id - t.string :user_id - t.datetime :created_at¬ - t.datetime :updated_at¬ - end¬ -¬ - add_index "reviews", ["nct_id"], name: "index_reviews_on_nct_id", using: :btree¬ - add_index "reviews", ["user_id"], name: "index_reviews_on_user_id", using: :btree¬ + create_table :reviews do |t| + t.integer :rating + t.text :comment + t.string :nct_id + t.string :user_id + t.datetime :created_at + t.datetime :updated_at + end + + add_index "reviews", ["nct_id"], name: "index_reviews_on_nct_id", using: :btree + add_index "reviews", ["user_id"], name: "index_reviews_on_user_id", using: :btree + end end
Fix a bunch of typos in the create_reviews table migration
diff --git a/lib/console_color/railtie.rb b/lib/console_color/railtie.rb index abc1234..def5678 100644 --- a/lib/console_color/railtie.rb +++ b/lib/console_color/railtie.rb @@ -4,11 +4,15 @@ def setup(*) super - app_name = Rails.application.class.parent_name.downcase + app_name = if Rails.application.class.respond_to?(:module_parent_name) + Rails.application.class.module_parent_name + else + Rails.application.class.parent_name + end environment = ENV.fetch('CONSOLE_COLOR_ENV', Rails.env) color = ConsoleColor::COLORS[environment] - prompt = "\001#{color}\002#{app_name}:#{environment}" + prompt = "\001#{color}\002#{app_name.downcase}:#{environment}" IRB.conf[:PROMPT][:RAILS_APP] = { PROMPT_I: "#{prompt}>\e[0m ",
Support module_parent_name instead of deprecated parent_name
diff --git a/config.ru b/config.ru index abc1234..def5678 100644 --- a/config.ru +++ b/config.ru @@ -2,10 +2,10 @@ require ::File.expand_path('../config/environment', __FILE__) -if Rails.env.production? - map '/daily' do - run Daily::Application - end +#if Rails.env.production? +# map '/daily' do +# run Daily::Application +# end #else -# run Daily::Application + run Daily::Application #end
Revert "pushing back the map" This reverts commit 7a88ab758602fdc7b4456f2232989c9d16429e64.
diff --git a/related_word.gemspec b/related_word.gemspec index abc1234..def5678 100644 --- a/related_word.gemspec +++ b/related_word.gemspec @@ -11,7 +11,7 @@ spec.summary = %q{A gem for finding related words of a word} spec.description = %q{A gem for finding related words of a word using semantic-link.com} - spec.homepage = "" + spec.homepage = "https://github.com/lmduc/related_word" spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
Update the homepage in the gemspec
diff --git a/w3clove.gemspec b/w3clove.gemspec index abc1234..def5678 100644 --- a/w3clove.gemspec +++ b/w3clove.gemspec @@ -15,7 +15,7 @@ s.rubyforge_project = "w3clove" - s.add_dependency 'w3c_validators' + s.add_dependency 'w3c_validators', '1.0.2' s.add_dependency 'nokogiri' s.files = `git ls-files`.split("\n")
Use version 1.0.2 of w3c_love as 1.1.1 has a bug
diff --git a/app/controllers/lunar_shell/interpreter_controller.rb b/app/controllers/lunar_shell/interpreter_controller.rb index abc1234..def5678 100644 --- a/app/controllers/lunar_shell/interpreter_controller.rb +++ b/app/controllers/lunar_shell/interpreter_controller.rb @@ -21,8 +21,13 @@ helper_method :satellite def output - satellite.try(:run) || "Command not found: #{command}." + return command_not_found unless satellite + satellite.try(:run) end helper_method :output + + def command_not_found + command ? "Command not found: #{command}." : '' + end end end
Return if no command provided
diff --git a/app/controllers/spree/admin/sale_prices_controller.rb b/app/controllers/spree/admin/sale_prices_controller.rb index abc1234..def5678 100644 --- a/app/controllers/spree/admin/sale_prices_controller.rb +++ b/app/controllers/spree/admin/sale_prices_controller.rb @@ -30,7 +30,7 @@ # Load the product as a before filter. Redirect to the referer if no product is found def load_product - @product = Spree::Product.find_by_permalink(params[:product_id]) + @product = Spree::Product.find_by(slug: params[:product_id]) redirect_to request.referer unless @product.present? end @@ -47,4 +47,4 @@ end end -end+end
Make sales_price compatible with spree 2.1 and Rails 4.x
diff --git a/lib/rapidash/resourceable.rb b/lib/rapidash/resourceable.rb index abc1234..def5678 100644 --- a/lib/rapidash/resourceable.rb +++ b/lib/rapidash/resourceable.rb @@ -10,9 +10,9 @@ def resource(*names) mod = self.to_s.split("::")[0...-1] if mod.empty? - mod = Kernel + mod = Object else - mod = Kernel.const_get(mod.join("::")) + mod = Object.const_get(mod.join("::")) end
Fix: Use Object.const_defined instead of Kernel This fixes checking const_defined? for ruby 1.8.7 Resources: * http://www.ruby-forum.com/topic/144313
diff --git a/jekyll-mentions.gemspec b/jekyll-mentions.gemspec index abc1234..def5678 100644 --- a/jekyll-mentions.gemspec +++ b/jekyll-mentions.gemspec @@ -11,6 +11,7 @@ s.add_dependency "jekyll", "~> 3.0" s.add_dependency "html-pipeline", "~> 2.3" + s.add_dependency "activesupport", "~> 4.0" s.add_development_dependency "rake" s.add_development_dependency "rdoc"
Fix tests for Ruby < 2.3
diff --git a/spec/support/pages/overlays/add_authors.rb b/spec/support/pages/overlays/add_authors.rb index abc1234..def5678 100644 --- a/spec/support/pages/overlays/add_authors.rb +++ b/spec/support/pages/overlays/add_authors.rb @@ -1,6 +1,6 @@ class AddAuthorsOverlay < CardOverlay def add_author(author) - find(".button-secondary", text: "ADD A NEW AUTHOR").click + find(".button-primary", text: "ADD A NEW AUTHOR").click group = find('.add-author-form') within(group) do fill_in_author_form author
Fix tests to match styles
diff --git a/static-sprockets.gemspec b/static-sprockets.gemspec index abc1234..def5678 100644 --- a/static-sprockets.gemspec +++ b/static-sprockets.gemspec @@ -17,13 +17,13 @@ gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) gem.require_paths = ["lib"] - gem.add_runtime_dependency 'rack', '~> 1.0' + gem.add_runtime_dependency 'rack' gem.add_runtime_dependency 'rack-putty', '0.0.1' gem.add_runtime_dependency 'sass' gem.add_runtime_dependency 'sprockets-sass' gem.add_runtime_dependency 'sprockets-helpers' - gem.add_runtime_dependency 'sprockets', '~> 2.0' + gem.add_runtime_dependency 'sprockets' gem.add_runtime_dependency 'sprockets-rainpress' gem.add_runtime_dependency 'uglifier' gem.add_runtime_dependency 'mimetype-fu'
Make dependency versions less strict Signed-off-by: Jesse Stuart <a5c95b3d7cb4d0ae05a15c79c79ab458dc2c8f9e@jessestuart.ca>
diff --git a/config/schedule.rb b/config/schedule.rb index abc1234..def5678 100644 --- a/config/schedule.rb +++ b/config/schedule.rb @@ -1,5 +1,5 @@ set :output, {:error => 'log/cron.error.log', :standard => 'log/cron.log'} -job_type :rake, 'cd :path && /usr/local/bin/govuk_setenv search bundle exec rake :task :output' +job_type :rake, 'cd :path && /usr/local/bin/govuk_setenv rummager bundle exec rake :task :output' # Sitemap filenames are generated based on the current day and hour. Putting # this at 10 past gets around any problems that might arise from running just
Fix sitemap generation cron command Rummager is now using the name "rummager" in production, rather than search. This is encoded in the command which is scheduled to run nightly to generate sitemaps. For now, just update this. Later, this should be specified by an environment variable, or other configuration outside the app.
diff --git a/app/serializers/product_shallow_serializer.rb b/app/serializers/product_shallow_serializer.rb index abc1234..def5678 100644 --- a/app/serializers/product_shallow_serializer.rb +++ b/app/serializers/product_shallow_serializer.rb @@ -3,13 +3,7 @@ attributes :homepage_url def logo_url - image_url = if object.logo.present? - object.logo.url - elsif object.poster.present? - object.poster_image.url - else - '/assets/app_icon.png' - end + object.full_logo_url end def url
Use the correct logo url for the shallow serializer
diff --git a/lib/appraisal/command.rb b/lib/appraisal/command.rb index abc1234..def5678 100644 --- a/lib/appraisal/command.rb +++ b/lib/appraisal/command.rb @@ -43,7 +43,11 @@ end def announce - puts ">> BUNDLE_GEMFILE=#{@gemfile} #{@command}" + if @gemfile + puts ">> BUNDLE_GEMFILE=#{@gemfile} #{@command}" + else + puts ">> #{@command}" + end end def unset_bundler_env_vars
Make announce method not to say "BUNDLE_GEMFILE=" if we're not currently setting ENV['BUNDLE_GEMFILE']
diff --git a/contestify.gemspec b/contestify.gemspec index abc1234..def5678 100644 --- a/contestify.gemspec +++ b/contestify.gemspec @@ -14,4 +14,6 @@ gem.name = "contestify" gem.require_paths = ["lib"] gem.version = Contestify::VERSION + + gem.add_development_dependency "rake", "~> 0.9.2" end
Add rake as a dev dependency
diff --git a/Library/Homebrew/formula_pin.rb b/Library/Homebrew/formula_pin.rb index abc1234..def5678 100644 --- a/Library/Homebrew/formula_pin.rb +++ b/Library/Homebrew/formula_pin.rb @@ -1,5 +1,3 @@-require 'fileutils' - class FormulaPin PINDIR = Pathname.new("#{HOMEBREW_LIBRARY}/PinnedKegs") @@ -12,9 +10,9 @@ end def pin_at(version) - PINDIR.mkpath unless PINDIR.exist? + PINDIR.mkpath version_path = @f.rack.join(version) - FileUtils.ln_s(version_path, path) unless pinned? or not version_path.exist? + path.make_relative_symlink(version_path) unless pinned? || !version_path.exist? end def pin @@ -24,7 +22,7 @@ end def unpin - FileUtils.rm(path) if pinned? + path.unlink if pinned? end def pinned?
Remove FormulaPin dependency on FileUtils
diff --git a/recipes/simple_launch.rb b/recipes/simple_launch.rb index abc1234..def5678 100644 --- a/recipes/simple_launch.rb +++ b/recipes/simple_launch.rb @@ -1,4 +1,6 @@ # Creates a simple setup of an IPython notebook server, creating a dummy user, a place to store IPython notebooks, and sets up IPython notebook as a service + +node[:supervisor][:version] = "3.0b2" include_recipe "supervisor"
Fix version information for supervisor
diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index abc1234..def5678 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -26,6 +26,7 @@ Capybara.register_driver :poltergeist do |app| Capybara::Poltergeist::Driver.new(app, + timeout: 1.minute, inspector: true, # allows remote debugging by executing page.driver.debug phantomjs_logger: File.open(File::NULL, "w"), # don't print console.log calls in console phantomjs_options: ['--load-images=no', '--disk-cache=false'],
Increase Poltergeist timeout in specs This is to try to avoid flaky js specs in Travis
diff --git a/spec/userstream_spec.rb b/spec/userstream_spec.rb index abc1234..def5678 100644 --- a/spec/userstream_spec.rb +++ b/spec/userstream_spec.rb @@ -4,21 +4,25 @@ describe Userstream do before do - @consumer = OAuth::Consumer.new('consumer key', 'consumer secret', site: 'https://userstream.twitter.com/') - @access_token = OAuth::AccessToken.new(@consumer, 'oauth token', 'oauth token secret') - @userstream = Userstream.new(@access_token) + Userstream.configure do |config| + config.consumer_key = 'consumer key' + config.consumer_secret = 'consumer secret' + config.oauth_token = 'oauth token' + config.oauth_token_secret = 'oauth token secret' + end + @client = Userstream.client end - describe :new do - subject { @userstream } - it { should be_instance_of Userstream } + describe :client do + subject { @client } + it { should be_a Userstream::Client } end describe :user do context 'not block given' do it do lambda { - @userstream.user + @client.user }.should raise_error(ArgumentError) end end
Add spec that change how to use library.
diff --git a/spec/controllers/comments_controller_spec.rb b/spec/controllers/comments_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/comments_controller_spec.rb +++ b/spec/controllers/comments_controller_spec.rb @@ -2,8 +2,8 @@ describe CommentsController, :type => :controller do - let!(:query) { FactoryGirl.create :query } - + @parent = let!(:query) { FactoryGirl.create :query } + let(:user) { FactoryGirl.create :user } context "GET #new" do @@ -16,25 +16,29 @@ end context "POST #create" do - subject { FactoryGirl.create(:comment) } it "should create a comment when params are valid" do stub_authorize_user! - post :create - expect { subject }.to change{Comment.count}.by(1) + expect { + + post :create, comment: FactoryGirl.create(:comment) + }.to change{Comment.count}.by(1) end it "should redirect to query page on successful save" do stub_authorize_user! - post :create - expect(subject).to redirect_to(queries_path) + expect( + post :create, comment: FactoryGirl.create(:comment) + ).to redirect_to(languages_path) + # expect(response).to redirect_to(query_comments_path(query)) #Should be this but there is a problem with routes + end it "should re-render new template on failed save" do #BUGBUG stub_authorize_user! - post :create - comment = FactoryGirl.build(:comment, content: nil) - expect(response).to render_template("comments/new") + expect( + post :create, comment: FactoryGirl.attributes_for(:comment, content: nil) + ).to render_template(:new) end end
Fix third test to accommodate changes in comments controller
diff --git a/spec/lib/importers/category_importer_spec.rb b/spec/lib/importers/category_importer_spec.rb index abc1234..def5678 100644 --- a/spec/lib/importers/category_importer_spec.rb +++ b/spec/lib/importers/category_importer_spec.rb @@ -20,9 +20,9 @@ end context 'for depth 1' do - let(:category) { 'Category:Crocodile Dundee' } - let(:article_in_cat) { 'Michael "Crocodile" Dundee' } - let(:article_in_subcat) { 'Crocodile Dundee in Los Angeles' } + let(:category) { 'Category:Monty Python films' } + let(:article_in_cat) { "Monty Python's Life of Brian" } + let(:article_in_subcat) { 'Knights Who Say "Ni!"' } let(:depth) { 1 } it 'works recursively for subcategories' do
Update spec to test a subcategory The old example of a small subcategory got reorganized on-wiki so that it no longer had a sub-category.
diff --git a/lib/public_activity/orm/active_record/activity.rb b/lib/public_activity/orm/active_record/activity.rb index abc1234..def5678 100644 --- a/lib/public_activity/orm/active_record/activity.rb +++ b/lib/public_activity/orm/active_record/activity.rb @@ -27,7 +27,7 @@ end # Serialize parameters Hash - if table_exists? && !columns_hash['parameters'].type.in?([:json, :jsonb, :hstore]) + if table_exists? && ![:json, :jsonb, :hstore].include?(columns_hash['parameters'].type) serialize :parameters, Hash end
Fix relying on activesupport in? method
diff --git a/examples/dcell-hazelcast.rb b/examples/dcell-hazelcast.rb index abc1234..def5678 100644 --- a/examples/dcell-hazelcast.rb +++ b/examples/dcell-hazelcast.rb @@ -5,10 +5,10 @@ # The DCell node_id name = nil -# The local port for the 0MZ communication. +# The local port for the 0MQ communication. port = nil -registry = {:adapter => 'hazelcast'} +registry = {:adapter => 'hazelcast', :env => 'test'} OptionParser.new.tap { |options| options.on('-n NAME', 'Node name') do |value|
Set env in example and fix typo.
diff --git a/test/rails_helper.rb b/test/rails_helper.rb index abc1234..def5678 100644 --- a/test/rails_helper.rb +++ b/test/rails_helper.rb @@ -20,7 +20,7 @@ root = File.expand_path(File.dirname(__FILE__)) # Define the application and configuration -module Config +module Test class Application < ::Rails::Application # configuration here if needed config.active_support.deprecation = :stderr @@ -28,9 +28,9 @@ end # Initialize the application -Config::Application.initialize! +Test::Application.initialize! -Config::Application.routes.draw do +Test::Application.routes.draw do resources :posts match 'title/:id', :to => 'title#update', :via => :put
Clear warning with testing rails app
diff --git a/lib/params_sanitizers.rb b/lib/params_sanitizers.rb index abc1234..def5678 100644 --- a/lib/params_sanitizers.rb +++ b/lib/params_sanitizers.rb @@ -2,18 +2,24 @@ # with only params which are permitted. It's similar to Rails permitted params module BaseParamsSanitizer + def self.included(klass) + klass.extend ClassMethods + end + attr_reader :params def initialize(params) @params = params end - def self.call(params) - new(params).call + def call + params.keep_if { |key, _| permitted_keys.include? key } end - def call - params.keep_if { |key, _| permitted_keys.include? key } + module ClassMethods + def call(params) + new(params).call + end end end
Fix class methods extending in params sanitizers
diff --git a/lib/sqsearch/core_ext.rb b/lib/sqsearch/core_ext.rb index abc1234..def5678 100644 --- a/lib/sqsearch/core_ext.rb +++ b/lib/sqsearch/core_ext.rb @@ -9,9 +9,9 @@ def search(query,options={}) search_obj = Search.new(@fields) @fields.each do |field| - search_obj.query_string << "#{field} like '%#{query}%'" + search_obj.query_string << "#{field} like :query" end - search_obj.results = where(search_obj.query_string.join(" OR ")) + search_obj.results = where(search_obj.query_string.join(" OR "), {:query=>"%#{query}%"}) search_obj end end
Change the where clause to prevent using direct string.
diff --git a/lib/pgpool/node_info.rb b/lib/pgpool/node_info.rb index abc1234..def5678 100644 --- a/lib/pgpool/node_info.rb +++ b/lib/pgpool/node_info.rb @@ -18,16 +18,16 @@ public def self.build_from_raw_data(id, command_raw_data) - host, port, status, weight = command_raw_data.split(' ') + hostname, port, status, weight = command_raw_data.split(' ') - NodeInfo.new(id, host, port, status, weight) + NodeInfo.new(id, hostname, port, status, weight) end - attr_reader :id, :host, :port, :weight, :status + attr_reader :id, :hostname, :port, :weight, :status - def initialize(id, host, port, status, weight) + def initialize(id, hostname, port, status, weight) @id = id.to_i - @host = host + @hostname = hostname @port = port.to_i @weight = weight.to_f @@ -49,7 +49,7 @@ end def to_hash - { id: id, host: host, port: port, status: status, weight: weight } + { id: id, hostname: hostname, port: port, status: status, weight: weight } end def inspect
Add a method to recover error messages
diff --git a/lib/rubinius/toolset.rb b/lib/rubinius/toolset.rb index abc1234..def5678 100644 --- a/lib/rubinius/toolset.rb +++ b/lib/rubinius/toolset.rb @@ -15,7 +15,7 @@ if block_given? begin - loaded_features = $LOADED_FEATURES + loaded_features = $LOADED_FEATURES.dup $LOADED_FEATURES.clear yield @current
Make sure $LOADED_FEATURES gets restored after create block Previously, a reference to the about-to-be-mutated array was being stored as the backup to restore from at the end of the block.
diff --git a/config.rb b/config.rb index abc1234..def5678 100644 --- a/config.rb +++ b/config.rb @@ -18,7 +18,7 @@ after_build do puts "\nCopying GitHub-specific files" - `cp -rv ./github/ ./build` + `cp -rv ./github/* ./build/` end activate :deploy do |deploy|
Copy only contents of folder.
diff --git a/config.ru b/config.ru index abc1234..def5678 100644 --- a/config.ru +++ b/config.ru @@ -17,6 +17,9 @@ 'rack.warmup.error' => error Gallerist::App.disable :show_exceptions unless Gallerist::App.development? raise error.first unless error.empty? + + Rack::MockRequest.new(app).get '/assets/main.css' + Rack::MockRequest.new(app).get '/assets/main.js' end map '/assets' do
Use warmup to precompile assets
diff --git a/config.ru b/config.ru index abc1234..def5678 100644 --- a/config.ru +++ b/config.ru @@ -3,6 +3,8 @@ require "opal/rspec" require "opal-jquery" + +Opal::Config.arity_check_enabled = true if Opal::RSpec.const_defined?("SprocketsEnvironment") sprockets_env = Opal::RSpec::SprocketsEnvironment.new
Enable arity check for test
diff --git a/lib/tasks/surfline.rake b/lib/tasks/surfline.rake index abc1234..def5678 100644 --- a/lib/tasks/surfline.rake +++ b/lib/tasks/surfline.rake @@ -8,6 +8,7 @@ Spot.find_by(surfline_id: 4203), Spot.find_by(surfline_id: 4127), Spot.find_by(surfline_id: 4190), + Spot.find_by(surfline_id: 6064), ] spots.each do |spot|
Add Portugal to Surfline rake task
diff --git a/templates/errors.rb b/templates/errors.rb index abc1234..def5678 100644 --- a/templates/errors.rb +++ b/templates/errors.rb @@ -8,21 +8,27 @@ # notify_hoptoad error # end -HTTP_ERRORS = [Timeout::Error, - Errno::EINVAL, - Errno::ECONNRESET, - EOFError, - Net::HTTPBadResponse, - Net::HTTPHeaderSyntaxError, - Net::ProtocolError] +HTTP_ERRORS = [ + EOFError, + Errno::ECONNRESET, + Errno::EINVAL, + Net::HTTPBadResponse, + Net::HTTPHeaderSyntaxError, + Net::ProtocolError, + Timeout::Error +] -SMTP_SERVER_ERRORS = [TimeoutError, - IOError, - Net::SMTPUnknownError, - Net::SMTPServerBusy, - Net::SMTPAuthenticationError] +SMTP_SERVER_ERRORS = [ + IOError, + Net::SMTPAuthenticationError, + Net::SMTPServerBusy, + Net::SMTPUnknownError, + Timeout::Error +] -SMTP_CLIENT_ERRORS = [Net::SMTPFatalError, - Net::SMTPSyntaxError] +SMTP_CLIENT_ERRORS = [ + Net::SMTPFatalError, + Net::SMTPSyntaxError +] SMTP_ERRORS = SMTP_SERVER_ERRORS + SMTP_CLIENT_ERRORS
Fix `TimeoutError` depreciation warning by using `Timeout::Error` Deprecated since Ruby 2.3.0
diff --git a/test/routes_test.rb b/test/routes_test.rb index abc1234..def5678 100644 --- a/test/routes_test.rb +++ b/test/routes_test.rb @@ -14,7 +14,11 @@ attr_reader :routes def setup - @routes = draw_routes { |set| set.filter :test } + @routes = if rails_2? + draw_routes { |set| set.filter :test } + else + draw_routes { filter :test } + end end test "routes.filter instantiates and registers a filter" do
Use the new router DSL for Rails 3
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 @@ -6,3 +6,7 @@ $LOAD_PATH.push File.expand_path("../../lib", __FILE__) require File.dirname(__FILE__) + '/../lib/simctl.rb' + +if ENV['TRAVIS'] + SimCtl.default_timeout = 120 +end
Use higher timeout on Travis
diff --git a/test/test_runner.rb b/test/test_runner.rb index abc1234..def5678 100644 --- a/test/test_runner.rb +++ b/test/test_runner.rb @@ -2,17 +2,16 @@ class TestRunner < Test::Unit::TestCase context "A Runner instance" do - setup { - @r = Rutty::Runner.new - call_init - } - - should "respond to config" do - assert_respond_to @r, :config + setup do + ensure_fresh_config! + @r = Rutty::Runner.new TEST_CONF_DIR end - should "respond to nodes" do + should "respond to its methods" do + assert_respond_to @r, :config assert_respond_to @r, :nodes + assert_respond_to @r, :config_dir + assert_respond_to @r, :config_dir= end should "return the correct object type for #config" do @@ -22,5 +21,14 @@ should "return the correct object type for #nodes" do assert_instance_of Rutty::Nodes, @r.nodes end + + should "correctly initialize with a supplied configuration directory" do + assert_equal @r.config_dir, TEST_CONF_DIR + end + + should "correctly fall back to default configuration directory" do + r = Rutty::Runner.new + assert_equal r.config_dir, Rutty::Consts::CONF_DIR + end end end
Update Rutty::Runner tests to reflect changes
diff --git a/Swinject.podspec b/Swinject.podspec index abc1234..def5678 100644 --- a/Swinject.podspec +++ b/Swinject.podspec @@ -11,11 +11,13 @@ s.source = { :git => "https://github.com/Swinject/Swinject.git", :tag => s.version.to_s } shared_files = 'Swinject/*.swift' - s.ios.source_files = shared_files, 'Swinject/iOS/*.{swift,h,m}' + s.ios.source_files = shared_files, 'Swinject/iOS-tvOS/*.{swift,h,m}' s.osx.source_files = shared_files, 'Swinject/OSX/*.{swift,h,m}' s.watchos.source_files = shared_files, 'Swinject/watchOS/*.{swift,h,m}' + s.tvos.source_files = shared_files, 'Swinject/iOS-tvOS/*.{swift,h,m}' s.ios.deployment_target = '8.0' s.osx.deployment_target = '10.10' s.watchos.deployment_target = '2.0' + s.tvos.deployment_target = '9.0' s.requires_arc = true end
Add tvOS target to podspec.
diff --git a/TraktKit.podspec b/TraktKit.podspec index abc1234..def5678 100644 --- a/TraktKit.podspec +++ b/TraktKit.podspec @@ -1,22 +1,16 @@ Pod::Spec.new do |s| - s.name = "TraktKit" - s.version = "1.0.2" + s.version = "1.0.3" s.summary = "Swift wrapper for Trakt.tv API" s.homepage = "https://github.com/MaxHasADHD/TraktKit" - s.license = { :type => "MIT", :file => "License.md" } - s.authors = "Maximilian Litteral" - s.swift_version = "4.0" s.ios.deployment_target = "10.0" s.osx.deployment_target = "10.10" s.watchos.deployment_target = "3.0" - s.source = { :git => "https://github.com/MaxHasADHD/TraktKit.git", :tag => "#{s.version}" } s.source_files = "Common", "Common/**/*.{h,m,swift}" - + s.swift_version = "4.2" s.requires_arc = true - end
Set Swift 4.2 as Swift version
diff --git a/config/initializers/exception_notification.rb b/config/initializers/exception_notification.rb index abc1234..def5678 100644 --- a/config/initializers/exception_notification.rb +++ b/config/initializers/exception_notification.rb @@ -1,6 +1,6 @@ unless Rails.env.development? or Rails.env.test? Rails.application.config.middleware.use ExceptionNotifier, - :email_prefix => "[#{Rails.application.to_s.split('::').first}] ", + :email_prefix => "[#{Rails.application.class.name.split('::').first} (#{Plek.current.environment})] ", :sender_address => %{"Winston Smith-Churchill" <winston@alphagov.co.uk>}, :exception_recipients => %w{govuk-exceptions@digital.cabinet-office.gov.uk} -end+end
Improve exception email subject line
diff --git a/test/cirrus/test_cirrus.rb b/test/cirrus/test_cirrus.rb index abc1234..def5678 100644 --- a/test/cirrus/test_cirrus.rb +++ b/test/cirrus/test_cirrus.rb @@ -17,4 +17,12 @@ }.must_raise Cirrus::UnlockableException end + def test_it_releases_if_there_is_an_error + lambda { + Cirrus.lock(@redis, 1, 2) { raise ArgumentError } + }.must_raise ArgumentError + + assert_equal(:foo, Cirrus.lock(@redis, 1, 2) { :foo }) + end + end
Include test case for exceptions being raised, and ensuring release
diff --git a/test/models/markov_test.rb b/test/models/markov_test.rb index abc1234..def5678 100644 --- a/test/models/markov_test.rb +++ b/test/models/markov_test.rb @@ -15,12 +15,12 @@ test "post processing" do temp_markov = {} temp_markov = Markov.process_post(temp_markov, "@colinfike Hey!! \n funny stuff http://tester.com/whop") - assert temp_markov == {"["=>{"Hey"=>1}, "Hey"=>{"funny"=>1}, "funny"=>{"stuff"=>1}, "stuff"=>{"]"=>1}} + assert_equal temp_markov, {"["=>{"Hey"=>1}, "Hey"=>{"funny"=>1}, "funny"=>{"stuff"=>1}, "stuff"=>{"]"=>1}} end test "sentence generation" do user = User.create(twitter_username: 'colinfike', markov_chain: {"["=>{"Hey"=>1}, "Hey"=>{"funny"=>1}, "funny"=>{"stuff"=>1}, "stuff"=>{"]"=>1}}) generated_sentence = Markov.generate_sentence(user) - assert generated_sentence == "Hey funny stuff." + assert_equal generated_sentence, "Hey funny stuff." end end
Change up the tests a bit
diff --git a/lib/generators/sauce/install/install_generator.rb b/lib/generators/sauce/install/install_generator.rb index abc1234..def5678 100644 --- a/lib/generators/sauce/install/install_generator.rb +++ b/lib/generators/sauce/install/install_generator.rb @@ -46,6 +46,7 @@ ] conf.application_host = "127.0.0.1" conf.application_port = "3001" + conf.browser_url = "http://localhost:3001/" end CONFIG end
Make sure we set an actual browser_url, else the driver won't know where to go (defaulting to saucelabs.com)
diff --git a/amazon-drs.gemspec b/amazon-drs.gemspec index abc1234..def5678 100644 --- a/amazon-drs.gemspec +++ b/amazon-drs.gemspec @@ -21,4 +21,6 @@ spec.add_development_dependency "bundler", "~> 1.13" spec.add_development_dependency "rake", "~> 12.0" + spec.add_development_dependency "test-unit" + spec.add_development_dependency "webmock" end
Add development dependency: test-unit, webmock
diff --git a/lyb_devise_admin.gemspec b/lyb_devise_admin.gemspec index abc1234..def5678 100644 --- a/lyb_devise_admin.gemspec +++ b/lyb_devise_admin.gemspec @@ -2,7 +2,7 @@ # project in your rails apps through git. Gem::Specification.new do |s| s.name = "lyb_devise_admin" - s.summary = "LybDeviseAdmin provides a ready-to-use admin interface for device." + s.summary = "LybDeviseAdmin provides a ready-to-use admin interface for devise." s.authors = ["Simon Hürlimann (CyT)"] s.email = ["simon.huerlimann@cyt.ch"] s.description = "LybDeviseAdmin ."
Fix devise spelling in gemspec.
diff --git a/spec/factories/services.rb b/spec/factories/services.rb index abc1234..def5678 100644 --- a/spec/factories/services.rb +++ b/spec/factories/services.rb @@ -25,6 +25,14 @@ }) end + factory :prometheus_service do + project factory: :empty_project + active true + properties({ + api_url: 'https://prometheus.example.com/' + }) + end + factory :jira_service do project factory: :empty_project active true
Add support for Prometheus Service
diff --git a/spec/features/game_spec.rb b/spec/features/game_spec.rb index abc1234..def5678 100644 --- a/spec/features/game_spec.rb +++ b/spec/features/game_spec.rb @@ -22,7 +22,15 @@ end context "throw the first ball" do - it "kock down 3 pins" do + it "and saved the hit" do + visit new_game_path + click_link("btn-pins-0") + + game_id = URI.parse(current_url).request_uri.split("/")[2] + expect(BowlingGame.find(game_id).hits.size).to eq 1 + end + + it "knocked down 3 pins" do visit new_game_path click_link("btn-pins-3") expect(page).to have_content("Round 1")
Check the page save the atempt
diff --git a/spec/pith/metadata_spec.rb b/spec/pith/metadata_spec.rb index abc1234..def5678 100644 --- a/spec/pith/metadata_spec.rb +++ b/spec/pith/metadata_spec.rb @@ -28,6 +28,8 @@ -# --- -# x: 1 -# y: "2" + -# ... + -# other stuff HAML end
Check that other stuff can share a comment block with meta-data.
diff --git a/spec/request/users_spec.rb b/spec/request/users_spec.rb index abc1234..def5678 100644 --- a/spec/request/users_spec.rb +++ b/spec/request/users_spec.rb @@ -27,4 +27,11 @@ end end end + + context "when a user is not logged in" do + it "redirects them to sign in" do + get "/admin/users" + expect(response).to redirect_to("/users/sign_in") + end + end end
Add another test for when the user isn't logged in * spec/request/users_spec.rb: Ensure that when a user isn't logged in that they get redirected to sign in.
diff --git a/spec/system/params_spec.rb b/spec/system/params_spec.rb index abc1234..def5678 100644 --- a/spec/system/params_spec.rb +++ b/spec/system/params_spec.rb @@ -25,7 +25,7 @@ 'chain' => "'PREROUTING'", }, ].each do |param| - it 'test param' do + pending 'test param' do iptables_flush_all_tables ppm = pp(param)
Make param test pending due to rhel5 failures Signed-off-by: Ken Barber <470bc578162732ac7f9d387d34c4af4ca6e1b6f7@bob.sh>
diff --git a/stream.rb b/stream.rb index abc1234..def5678 100644 --- a/stream.rb +++ b/stream.rb @@ -29,22 +29,15 @@ end def length - @length || while true do end + while true do end end def each last_stream = self - - if @length - @length.times { - yield last_stream.head - last_stream = last_stream.tail - } - else - while true do - yield last_stream.head - last_stream = last_stream.tail - end + + while true do + yield last_stream.head + last_stream = last_stream.tail end nil @@ -58,5 +51,20 @@ @head = head @tail_block = tail_block end + + def length + @length + end + + def each + last_stream = self + + @length.times { + yield last_stream.head + last_stream = last_stream.tail + } + + nil + end end end
Move finite funcionality into approriate class