diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -20,8 +20,8 @@ # Section API objects if SECTIONS + $api_sections = {} SECTIONS.each do |section, config| - $api_sections = {} $api_sections[section] = ApiBridge::Query.new(API_PATH, Facets.facet_list, config["api_options"]) logger.info("Connecting to API for section: #{section}")
Fix logic to not empty $api_sections hash
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -2,7 +2,7 @@ protect_from_forgery rescue_from CanCan::AccessDenied do |exception| - @exception = exception + @violation = exception render :template => 'home/access_violation', :status => 403 end end
Update Violation Page for Error Message Update the Violation page to ensure the error is displayed in the view.
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -8,7 +8,7 @@ # Don't use SSL for the TrackingController and only in production force_ssl :if => Proc.new{ r = (controller_name != "tracking" && Rails.env.production?) - puts "***** controller_name: #{controller_name}, force_ssl here: #{r} *****" + logger.info "***** controller_name: #{controller_name}, force_ssl here: #{r} *****" r } end
Use logger to output debugging info
diff --git a/test/integration/admin/create_admin_test.rb b/test/integration/admin/create_admin_test.rb index abc1234..def5678 100644 --- a/test/integration/admin/create_admin_test.rb +++ b/test/integration/admin/create_admin_test.rb @@ -0,0 +1,23 @@+require "test_helper" + +class Admin::CreateAdminTest < ActionDispatch::IntegrationTest + test "system admin can login and create another system admin" do + log_in_as("system-admin@example.com", "password") + visit("/admin/users/new") + fill_in("Email", :with => "testing@example.com") + check("System admin") + + assert_difference("User.where(:system_admin => true).count") do + click_on("Send invitation") + end + end + + private + + def log_in_as(email, password) + visit("/en/login") + fill_in("Email", :with => email) + fill_in("Password", :with => password) + within("form") { click_on("Log in") } + end +end
Add integration test for creating admins
diff --git a/app/controllers/categories_controller.rb b/app/controllers/categories_controller.rb index abc1234..def5678 100644 --- a/app/controllers/categories_controller.rb +++ b/app/controllers/categories_controller.rb @@ -1,12 +1,12 @@ class CategoriesController < ApplicationController inherit_resources - actions :index, :show + actions :show def index - @node_types = collection.map(&:node_types).flatten.uniq - - index! do |format| + @categories = Category.all + @node_types = @categories.map(&:node_types).flatten.uniq + respond_to do |format| format.json { render json: { categories: @categories.as_api_response(:ember),
Rewrite CategoriesController index action to not use inherited_resources
diff --git a/spec/error_spec.rb b/spec/error_spec.rb index abc1234..def5678 100644 --- a/spec/error_spec.rb +++ b/spec/error_spec.rb @@ -4,14 +4,10 @@ describe Error do describe '#initialize' do context 'required params are set' do - subject { described_class.new(code: anything, message: anything) } - - it 'sets the code ivar' do - expect(subject.instance_variable_get(:@code)).to_not be_nil - end - - it 'sets the message ivar' do - expect(subject.instance_variable_get(:@message)).to_not be_nil + it 'does not raise error' do + expect do + described_class.new(code: anything, message: anything) + end.to_not raise_error end end
Test that the initialization does not raise error Instead of explicitly testing instance variable setting, simply test that no errors are raised with refactored kw arguments.
diff --git a/doc/ex/preview.rb b/doc/ex/preview.rb index abc1234..def5678 100644 --- a/doc/ex/preview.rb +++ b/doc/ex/preview.rb @@ -3,7 +3,14 @@ require 'RMagick' img = Magick::Image.read("images/Blonde_with_dog.jpg").first -preview = img.preview(Magick::SolarizePreview) + +begin + preview = img.preview(Magick::SolarizePreview) +rescue NotImplementedError + img = Image.read('images/notimplemented.gif').first + img.write('preview.jpg') + exit +end preview.minify.write('preview.jpg') exit
Handle "not supported" exception when built with IM < 5.5.8
diff --git a/spec/features/applications/over_61_applicants_can_complete_form_spec.rb b/spec/features/applications/over_61_applicants_can_complete_form_spec.rb index abc1234..def5678 100644 --- a/spec/features/applications/over_61_applicants_can_complete_form_spec.rb +++ b/spec/features/applications/over_61_applicants_can_complete_form_spec.rb @@ -0,0 +1,56 @@+# coding: utf-8 +require 'rails_helper' + +RSpec.feature 'Completing the application details', type: :feature do + + include Warden::Test::Helpers + Warden.test_mode! + + let!(:jurisdictions) { create_list :jurisdiction, 3 } + let!(:office) { create(:office, jurisdictions: jurisdictions) } + let!(:user) { create(:user, jurisdiction_id: jurisdictions[1].id, office: office) } + + before do + WebMock.disable_net_connect!(allow: ['127.0.0.1', 'codeclimate.com', 'www.google.com/jsapi']) + Capybara.current_driver = :webkit + Capybara.page.driver.allow_url('http://www.google.com/jsapi') + end + + after { Capybara.use_default_driver } + + context 'where the applicant is over 61', js: true do + before do + json = '{"original_client_ref": "unique", "benefit_checker_status": "Yes", + "confirmation_ref": "T1426267181940", + "@xmlns": "https://lsc.gov.uk/benefitchecker/service/1.0/API_1.0_Check"}' + stub_request(:post, "#{ENV['DWP_API_PROXY']}/api/benefit_checks"). + to_return(status: 200, body: json, headers: {}) + + login_as user + visit applications_new_path + fill_in 'application_last_name', with: 'SMITH' + fill_in 'application_date_of_birth', with: Time.zone.today - 65.years + fill_in 'application_ni_number', with: 'JL953007D' + choose 'application_married_false' + click_button 'Next' + find(:xpath, '(//input[starts-with(@id,"application_jurisdiction_id_")])[1]').click + fill_in 'application_fee', with: 410 + fill_in 'application_date_received', with: Time.zone.yesterday + click_button 'Next' + choose 'application_threshold_exceeded_false' + click_button 'Next' + choose 'application_benefits_false' + click_button 'Next' + choose 'application_dependents_true' + fill_in 'application_children', with: '3' + fill_in 'application_income', with: '1900' + click_button 'Next' + click_button 'Next' + end + + scenario 'shows the proper summary page' do + expect(page).to have_xpath('//div[contains(@class,"callout")][contains(@class, "callout-part")]/h3[@class="bold"]', text: 'The applicant must pay £40 towards the fee') + end + + end +end
Test for progression through over 61 applications
diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb index abc1234..def5678 100644 --- a/config/initializers/cookies_serializer.rb +++ b/config/initializers/cookies_serializer.rb @@ -1,3 +1,3 @@ # Be sure to restart your server when you modify this file. -Rails.application.config.action_dispatch.cookies_serializer = :json +Rails.application.config.action_dispatch.cookies_serializer = :hybrid
Use hybrid cookie serializer until everyone's cookies are JSON
diff --git a/favourite-language.gemspec b/favourite-language.gemspec index abc1234..def5678 100644 --- a/favourite-language.gemspec +++ b/favourite-language.gemspec @@ -1,9 +1,10 @@ Gem::Specification.new do |s| - s.name = 'favourite-language' - s.version = '0.1.1' - s.author = 'Andrew White' - s.email = 'andyw@pixeltrix.co.uk' - s.summary = <<-EOS + s.name = 'favourite-language' + s.version = '0.1.1' + s.author = 'Andrew White' + s.email = 'andyw@pixeltrix.co.uk' + s.homepage = 'https://github.com/pixeltrix/favourite-language' + s.summary = <<-EOS Provides a command line tool for getting a user's favourite programming language from their GitHub public repositories. EOS
Add link to GitHub repository
diff --git a/spec/actions_spec.rb b/spec/actions_spec.rb index abc1234..def5678 100644 --- a/spec/actions_spec.rb +++ b/spec/actions_spec.rb @@ -0,0 +1,81 @@+require 'printfection' + +module Printfection + class Widget < Resource + include Actions::Retrieve + include Actions::List + include Actions::Create + include Actions::Update + include Actions::Delete + + expose :id + expose :size + expose :quantity + + def self.url + "/widgets" + end + end + + describe Actions::Retrieve, ".retrieve" do + it "returns an instance of the resource for the given id" do + json_data = double + widget = double + + expect(Printfection).to receive(:get).with("/widgets/123").and_return(json_data) + expect(Widget).to receive(:new).with(json_data).and_return(widget) + expect(Widget.retrieve(123)).to eql widget + end + end + + describe Actions::List, ".all" do + it "returns an array of instances of the resource" do + json_data1, json_data2 = double, double + widget1, widget2 = double, double + + expect(Printfection).to receive(:get).with("/widgets").and_return([json_data1, json_data2]) + expect(Widget).to receive(:new).with(json_data1).and_return(widget1) + expect(Widget).to receive(:new).with(json_data2).and_return(widget2) + + expect(Widget.all).to eql [widget1, widget2] + end + end + + describe Actions::Create, ".create" do + it "creates, saves, and returns a new resource with the response data" do + params = double + json_data = double + new_widget = double + + expect(Printfection).to receive(:post). + with("/widgets", params). + and_return(json_data) + + expect(Widget).to receive(:new). + with(json_data). + and_return(new_widget) + + widget = Widget.create(params) + expect(widget).to eql new_widget + end + end + + describe Actions::Update, "#save" do + it "performs a patch with the resource's changed data" do + widget = Widget.new(:id => 123, :size => "Medium", :quantity => 5) + widget.size = "Large" + expect(Printfection).to receive(:patch). + with("/widgets/123", {:size => "Large"}) + widget.save + end + end + + describe Actions::Delete, "#delete" do + it "performs a delete on the resource" do + widget = Widget.new(:id => 123) + expect(Printfection).to receive(:delete).with("/widgets/123") + widget.delete + end + end +end +
Add specs for Actions mixins
diff --git a/spec/default_spec.rb b/spec/default_spec.rb index abc1234..def5678 100644 --- a/spec/default_spec.rb +++ b/spec/default_spec.rb @@ -0,0 +1,23 @@+require 'chefspec' + +describe 'tdi-example-vim::default' do + let :chef_run do + ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '12.04') + end + + it 'should have default install_method "package"' do + chef_run.converge(described_recipe) + expect(chef_run.node['vim']['install_method']).to eq('package') + end + + it 'should include the vim::package recipe when install_method = "package"' do + chef_run.converge(described_recipe) + expect(chef_run).to include_recipe('tdi-example-vim::package') + end + + it 'should include the vim::source recipe when install_method = "source"' do + chef_run.node.set['vim']['install_method'] = 'source' + chef_run.converge(described_recipe) + expect(chef_run).to include_recipe('tdi-example-vim::source') + end +end
Add spec for default recipe
diff --git a/spec/quality_spec.rb b/spec/quality_spec.rb index abc1234..def5678 100644 --- a/spec/quality_spec.rb +++ b/spec/quality_spec.rb @@ -0,0 +1,60 @@+require "spec_helper" + +# Borrowed from Bundler +# https://github.com/carlhuda/bundler/blob/1-0-stable/spec/quality_spec.rb +describe "The library itself" do + def check_for_tab_characters(filename) + failing_lines = [] + File.readlines(filename).each_with_index do |line,number| + failing_lines << number + 1 if line =~ /\t/ + end + + unless failing_lines.empty? + "#{filename} has tab characters on lines #{failing_lines.join(', ')}" + end + end + + def check_for_extra_spaces(filename) + failing_lines = [] + File.readlines(filename).each_with_index do |line,number| + next if line =~ /^\s+#.*\s+\n$/ + failing_lines << number + 1 if line =~ /\s+\n$/ + end + + unless failing_lines.empty? + "#{filename} has spaces on the EOL on lines #{failing_lines.join(', ')}" + end + end + + RSpec::Matchers.define :be_well_formed do + failure_message_for_should do |actual| + actual.join("\n") + end + + match do |actual| + actual.empty? + end + end + + it "has no malformed whitespace" do + error_messages = [] + Dir.chdir(File.expand_path("../..", __FILE__)) do + `git ls-files`.split("\n").each do |filename| + next if filename =~ /\.gitmodules|fixtures/ + error_messages << check_for_tab_characters(filename) + error_messages << check_for_extra_spaces(filename) + end + end + error_messages.compact.should be_well_formed + end + + it "can still be built" do + Dir.chdir(File.expand_path('../../', __FILE__)) do + `gem build webmock.gemspec` + $?.should == 0 + + # clean up the .gem generated + system("rm webmock-#{WebMock.version}.gem") + end + end +end
Add a spec to enforce formatting code well This spec was ripped straight from Bundler (https://github.com/carlhuda/bundler/blob/1-0-stable/spec/quality_spec.rb)
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 @@ -11,3 +11,6 @@ # Only require the top-level files that are one level deep # All support/** sub-folders should be required by the top-level files Dir[Rails.root.join("spec/support/*.rb")].each { |file| require file } + +# Maintain the test schema to match the development schema at all times +ActiveRecord::Migration.maintain_test_schema!
Maintain the test schema migrations automatically
diff --git a/spec/support_spec.rb b/spec/support_spec.rb index abc1234..def5678 100644 --- a/spec/support_spec.rb +++ b/spec/support_spec.rb @@ -0,0 +1,22 @@+require 'spec_helper' + +describe RSpec::Puppet::Support do + subject do + klass = Class.new do + include RSpec::Puppet::Support + end + klass.new + end + + describe '#setup_puppet' do + it 'sets Puppet[:parser] to "current" by default' do + subject.setup_puppet + expect(Puppet[:parser]).to eq("current") + end + it 'reads the :parser setting' do + allow(subject).to receive(:parser).and_return("future") + subject.setup_puppet + expect(Puppet[:parser]).to eq("future") + end + end +end
Add spec coverage of parser configuration Without this patch we don't have any spec coverage of the :parser configuration addition in the previous patch. This patch adds two tests that makes sure the setup_puppet method configures Puppet with the :parser setting. We don't actually test to make sure the configuration is read from Rspec, but the majority of the behavior in the method is covered with respect to the parser setting.
diff --git a/test/logging_test.rb b/test/logging_test.rb index abc1234..def5678 100644 --- a/test/logging_test.rb +++ b/test/logging_test.rb @@ -0,0 +1,44 @@+require File.expand_path(File.join(File.dirname(__FILE__), "test_helper")) + +require 'onelogin/ruby-saml/logging' + +class LoggingTest < Minitest::Test + + describe "Logging" do + before do + ENV.delete('ruby-saml/testing') + end + + after do + ENV['ruby-saml/testing'] = '1' + end + + describe "given no specific logging setup" do + it "prints to stdout" do + OneLogin::RubySaml::Logging.expects(:puts).with('hi mom') + OneLogin::RubySaml::Logging.debug('hi mom') + end + end + + describe "given a Rails app" do + let(:logger) { mock('Logger') } + + before do + ::Rails = mock('Rails module') + ::Rails.stubs(:logger).returns(logger) + end + + after do + Object.instance_eval { remove_const(:Rails) } + end + + it "delegates to Rails" do + logger.expects(:debug).with('hi mom') + logger.expects(:info).with('sup?') + + OneLogin::RubySaml::Logging.debug('hi mom') + OneLogin::RubySaml::Logging.info('sup?') + end + end + end +end
Add tests for existing Logging functionality
diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index abc1234..def5678 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -42,7 +42,10 @@ def destroy @resource = @comment.resource @comment.destroy if correct_user?(@comment) - redirect_to resource_path(@resource) + respond_to do |f| + f.html {redirect_to resource_path(@resource)} + f.json {render json: @comment} + end end private
Add json reponse to delete.
diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index abc1234..def5678 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -0,0 +1,30 @@+class MessagesController < ApplicationController + #before_action :require_login + #before_action :validate_request_status, only: [:create] + + def index + #@messages = @request.messages + end + + def create + end + + private + + def require_login + unless current_user == @request.requester || current_user == @request.responder + flash[:error] = "This action requires you to be logged in" + redirect_to login_path + end + end + + def validate_request_status + unless @request.active? + flash[:error] = "This request is no longer active." + end + end + + def find_request + @request = Request.find_by(id: params[:request_id]).messages.include(:messages) + end +end
Add a Messages Controller for the message resource. The messages controller requires a user to be logged in; checks to make sure that the user is either a responder or a requester of a particular request before creating a new message. If the user successfully creates a new message, an event alert is sent to Pusher.com.
diff --git a/test/test_command.rb b/test/test_command.rb index abc1234..def5678 100644 --- a/test/test_command.rb +++ b/test/test_command.rb @@ -1,38 +1,6 @@ require 'helper' class TestCommand < Test::Unit::TestCase - context "when calling .ignore_paths" do - context "when source is absolute" do - setup { @source = source_dir } - should "return an array with regex for destination" do - absolute = source_dir('dest') - relative = Pathname.new(source_dir('dest')).relative_path_from(Pathname.new('.').expand_path).to_s - [absolute, relative].each do |dest| - config = build_configs("source" => @source, "destination" => dest) - assert Command.ignore_paths(config).include?(/dest/), "failed with destination: #{dest}" - end - end - end - context "when source is relative" do - setup { @source = Pathname.new(source_dir).relative_path_from(Pathname.new('.').expand_path).to_s } - should "return an array with regex for destination" do - absolute = source_dir('dest') - relative = Pathname.new(source_dir('dest')).relative_path_from(Pathname.new('.').expand_path).to_s - [absolute, relative].each do |dest| - config = build_configs("source" => @source, "destination" => dest) - assert Command.ignore_paths(config).include?(/dest/), "failed with destination: #{dest}" - end - end - end - context "multiple config files" do - should "return an array with regex for config files" do - config = build_configs("config"=> ["_config.yaml", "_config2.yml"]) - ignore_paths = Command.ignore_paths(config) - assert ignore_paths.include?(/_config\.yaml/), 'did not include _config.yaml' - assert ignore_paths.include?(/_config2\.yml/), 'did not include _config2.yml' - end - end - end context "when calling .add_build_options" do should "add common options" do cmd = Object.new
Remove tests for the Command.ignored_paths method which now lives in jekyll-watch.
diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb index abc1234..def5678 100644 --- a/app/controllers/profiles_controller.rb +++ b/app/controllers/profiles_controller.rb @@ -24,6 +24,16 @@ end def profile_params - params.require(:profile).permit(:avatar) + params + .require(:profile) + .permit( + :avatar, + :bio, + :rate, + :work_company, + :work_title, + :location, + :twitter_username + ) end end
Allow strong parameters to be editable
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index abc1234..def5678 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -25,9 +25,13 @@ end def destroy - current_user.logout_and_save! if current_user - session[:user_id] = nil - redirect_to login_path + if request.env['HTTP_REFERER'].nil? or !request.env['HTTP_REFERER'].match(/^http:\/\/(local|www)\.cloudsdale.org/i).nil? + current_user.logout_and_save! if current_user + session[:user_id] = nil + redirect_to login_path + else + redirect_to root_path + end end end
Make sure http referrer is from Cloudsdale. Signed-off-by: Philip Vieira <3ba3974e96044dcde818e6310ed799abe10671d4@vallin.se>
diff --git a/app/controllers/settings_controller.rb b/app/controllers/settings_controller.rb index abc1234..def5678 100644 --- a/app/controllers/settings_controller.rb +++ b/app/controllers/settings_controller.rb @@ -3,25 +3,28 @@ end def password - user = User.find_by_id(session[:user_id]) - @pass_form = ChangePasswordForm.new(user) + redirect_to settings_path, notice: 'Sorry, password changes not supported' - if @pass_form.submit(params) - redirect_to settings_path, notice: 'Password changed' - else - errors = "<div id='error_explanation'>" - errors += "<h2>#{@pass_form.errors.count} error(s) prohibited this project from being saved:</h2>" - errors == "<ul>" - @pass_form.errors.each do |message| - errors += "<li>#{message}</li>" - end - errors += "</ul>" - errors += "</div>" + # user = User.find_by_id(session[:user_id]) + # @pass_form = ChangePasswordForm.new(user) + # + # if @pass_form.submit(params) + # redirect_to settings_path, notice: 'Password changed' + # else + # errors = "<div id='error_explanation'>" + # errors += "<h2>#{@pass_form.errors.count} error(s) prohibited this project from being saved:</h2>" + # errors == "<ul>" + # @pass_form.errors.each do |message| + # errors += "<li>#{message}</li>" + # end + # errors += "</ul>" + # errors += "</div>" + # + # redirect_to settings_path, notice: errors.html_safe - redirect_to settings_path, notice: errors.html_safe # @errors = @pass_form.errors #redirect_to settings_path, errors: @errors # redirect_to settings_path, notice: @errors - end + # end end end
Disable password changes for now
diff --git a/dismissible_blocks.gemspec b/dismissible_blocks.gemspec index abc1234..def5678 100644 --- a/dismissible_blocks.gemspec +++ b/dismissible_blocks.gemspec @@ -20,6 +20,8 @@ 'LICENSE.txt' ] + s.post_install_message = 'DismissibleBlocks 2+ removed jQuery as a dependency. See README.' + s.add_runtime_dependency 'rails', '>= 3.2' s.add_development_dependency 'bundler'
Add RubyGems post install message
diff --git a/tests/aws/models/storage/url_tests.rb b/tests/aws/models/storage/url_tests.rb index abc1234..def5678 100644 --- a/tests/aws/models/storage/url_tests.rb +++ b/tests/aws/models/storage/url_tests.rb @@ -2,7 +2,7 @@ Shindo.tests('AWS | url', ["aws"]) do - @expires = DateTime.parse('2013-01-01T00:00:00Z').to_time.utc.to_i + @expires = Time.utc(2013,1,1).utc.to_i @storage = Fog::Storage.new( :provider => 'AWS',
[AWS] Create the time directly in tests, avoids using a method not present in 1.8.7
diff --git a/spec/btc_ticker_spec.rb b/spec/btc_ticker_spec.rb index abc1234..def5678 100644 --- a/spec/btc_ticker_spec.rb +++ b/spec/btc_ticker_spec.rb @@ -1,30 +1,28 @@ require "spec_helper" describe "BtcTicker::Bitstamp::API::Ticker" do - context "Given the input parameter - btc_usd" do - describe "#get_json" do - let(:ticker) { BtcTicker::Bitstamp::API::Ticker.new({:pair => "btc_usd"}) } + describe "#get_json" do + let(:ticker_btcusd) { BtcTicker::Bitstamp::API::Ticker.new({:pair => "btc_usd"}) } + let(:ticker_btceur) { BtcTicker::Bitstamp::API::Ticker.new({:pair => "btc_eur"}) } + + context "Given the input parameter - btc_usd" do it "must return the parsed btc_usd json data as an Hash object" do - expect(ticker.get_json).to be_an_instance_of Hash + expect(ticker_btcusd.get_json).to be_an_instance_of Hash end it "must not be empty" do - expect(ticker.get_json).to_not be_nil + expect(ticker_btcusd.get_json).to_not be_nil end end - end - context "Given the input parameter - btc_eur" do - describe "#get_json" do - let(:ticker) { BtcTicker::Bitstamp::API::Ticker.new({:pair => "btc_eur"}) } - + context "Given the input parameter - btc_eur" do it "must return the parsed btc_eur json data as an Hash object" do - expect(ticker.get_json).to be_an_instance_of Hash + expect(ticker_btceur.get_json).to be_an_instance_of Hash end it "must not be empty" do - expect(ticker.get_json).to_not be_nil + expect(ticker_btceur.get_json).to_not be_nil end end end
Refactor and clean up the code in the spec file
diff --git a/traject-solrj_writer.gemspec b/traject-solrj_writer.gemspec index abc1234..def5678 100644 --- a/traject-solrj_writer.gemspec +++ b/traject-solrj_writer.gemspec @@ -9,9 +9,8 @@ spec.version = Traject::SolrJWriter::VERSION spec.authors = ["Bill Dueber"] spec.email = ["bill@dueber.com"] - spec.summary = %q{TODO: Write a short summary. Required.} - spec.description = %q{TODO: Write a longer description. Optional.} - spec.homepage = "" + spec.summary = %q{Use Traject into index data into Solr using solrj under JRuby} + spec.homepage = "https://github.com/traject-project/traject-solrj_writer" spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0")
Update spec with homepage and summary
diff --git a/spec/notifyable_spec.rb b/spec/notifyable_spec.rb index abc1234..def5678 100644 --- a/spec/notifyable_spec.rb +++ b/spec/notifyable_spec.rb @@ -18,4 +18,14 @@ FwtPushNotificationServer.deliveries.count.should == 1 FwtPushNotificationServer.deliveries[0].recipients.count.should == 2 end + + it "sends zero notifications if the device is not valid" do + user = FactoryGirl.build(:user_with_invalid_apns_token) + + user.notify_once "Test" + + FwtPushNotificationServer.deliveries.count.should == 0 + + end + end
Add test for invalid token
diff --git a/spec/support/command.rb b/spec/support/command.rb index abc1234..def5678 100644 --- a/spec/support/command.rb +++ b/spec/support/command.rb @@ -1,18 +1,24 @@-def simple_command(v, opts = {}) - Expeditor::Command.new(opts) do - v +module CommandHelpers + def simple_command(v, opts = {}) + Expeditor::Command.new(opts) do + v + end + end + + def sleep_command(n, v, opts = {}) + Expeditor::Command.new(opts) do + sleep n + v + end + end + + def error_command(e, opts = {}) + Expeditor::Command.new(opts) do + raise e + end end end -def sleep_command(n, v, opts = {}) - Expeditor::Command.new(opts) do - sleep n - v - end +RSpec.configure do |c| + c.include CommandHelpers end - -def error_command(e, opts = {}) - Expeditor::Command.new(opts) do - raise e - end -end
Change global methods to module methods
diff --git a/acts_as_paranoid.gemspec b/acts_as_paranoid.gemspec index abc1234..def5678 100644 --- a/acts_as_paranoid.gemspec +++ b/acts_as_paranoid.gemspec @@ -6,11 +6,11 @@ Gem::Specification.new do |spec| spec.name = "acts_as_paranoid" spec.version = ActsAsParanoid::VERSION - spec.authors = ["Goncalo Silva", "Charles G.", "Rick Olson"] - spec.email = ["goncalossilva@gmail.com"] + spec.authors = ["Zachary Scott" "Goncalo Silva", "Charles G.", "Rick Olson"] + spec.email = ["e@zzak.io"] spec.summary = "Active Record plugin which allows you to hide and restore records without actually deleting them." spec.description = "Active Record plugin which allows you to hide and restore records without actually deleting them. Check its GitHub page for more in-depth information." - spec.homepage = "https://github.com/goncalossilva/rails3_acts_as_paranoid" + spec.homepage = "https://github.com/zzak/acts_as_paranoid" spec.license = "MIT" spec.files = Dir["{lib}/**/*.rb", "LICENSE", "*.md"]
Add Zachary to the authors and change the gem homepage.
diff --git a/lib/deployable/recipes/default_with_database.rb b/lib/deployable/recipes/default_with_database.rb index abc1234..def5678 100644 --- a/lib/deployable/recipes/default_with_database.rb +++ b/lib/deployable/recipes/default_with_database.rb @@ -37,6 +37,11 @@ require "deployable/passenger_standalone" after "deploy:setup", "passenger_standalone:setup" + # Config files support + require "deployable/config_files" + after "deploy:setup", "config_files:setup" + after "deploy:update_code", "config_files:install" + # Cleanup after "deploy", "deploy:cleanup" end
Add config files to default recipe
diff --git a/lib/paperclip_processors/custom_file_preview.rb b/lib/paperclip_processors/custom_file_preview.rb index abc1234..def5678 100644 --- a/lib/paperclip_processors/custom_file_preview.rb +++ b/lib/paperclip_processors/custom_file_preview.rb @@ -10,16 +10,26 @@ dst = TempfileFactory.new.generate("#{basename}.#{options[:format]}") begin - Paperclip.run( - libreoffice_path, - "--headless --invisible --convert-to png --outdir #{directory} #{@file.path}" - ) + if @file.content_type == 'application/pdf' + # We use special convert options for PDFs to improve quality and + # background, we append [0] to convert only the first page + convert( + ":source -resize '#{options[:geometry]}' -format #{options[:format]} -flatten -quality 70 :dest", + source: File.expand_path(@file.path) + '[0]', + dest: File.expand_path(dst.path) + ) + else + Paperclip.run( + libreoffice_path, + "--headless --invisible --convert-to png --outdir #{directory} #{@file.path}" + ) - convert( - ":source -resize '#{options[:geometry]}' -format #{options[:format]} #{options[:convert_options]} :dest", - source: File.expand_path(original_preview_file), - dest: File.expand_path(dst.path) - ) + convert( + ":source -resize '#{options[:geometry]}' -format #{options[:format]} #{options[:convert_options]} :dest", + source: File.expand_path(original_preview_file), + dest: File.expand_path(dst.path) + ) + end ensure File.delete(original_preview_file) if File.file?(original_preview_file) end
Move PDF thumbnail generation to ImageMagick Closes SCI-3579
diff --git a/lib/redmine_git_hosting/patches/member_patch.rb b/lib/redmine_git_hosting/patches/member_patch.rb index abc1234..def5678 100644 --- a/lib/redmine_git_hosting/patches/member_patch.rb +++ b/lib/redmine_git_hosting/patches/member_patch.rb @@ -9,7 +9,7 @@ base.class_eval do unloadable - after_commit :update_member + after_commit :update_member end end @@ -17,10 +17,9 @@ private - def update_member - RedmineGitolite::GitHosting.logger.info { "Membership changes on project '#{self.project}', update!" } - RedmineGitolite::GitHosting.resync_gitolite(:update_projects, [self.project.id]) - end + def update_member + UpdateProject.new(project, "Membership changes on project '#{project}', update!").call + end end
Use UseCase to update Project members
diff --git a/lib/streamy/message_buses/rabbit_message_bus.rb b/lib/streamy/message_buses/rabbit_message_bus.rb index abc1234..def5678 100644 --- a/lib/streamy/message_buses/rabbit_message_bus.rb +++ b/lib/streamy/message_buses/rabbit_message_bus.rb @@ -7,7 +7,6 @@ @topic_prefix = topic_prefix Hutch::Config.set(:uri, uri) Hutch::Config.set(:enable_http_api_use, false) - Hutch.connect end def deliver(*args) @@ -15,6 +14,7 @@ end def deliver_now(key:, topic:, type:, body:, event_time:) + Hutch.connect Hutch.publish( "#{topic_prefix}.#{topic}.#{type}", topic: topic,
Move the hutch connection out of message bus initializer
diff --git a/lib/twentyfour_seven_office/services/company.rb b/lib/twentyfour_seven_office/services/company.rb index abc1234..def5678 100644 --- a/lib/twentyfour_seven_office/services/company.rb +++ b/lib/twentyfour_seven_office/services/company.rb @@ -12,7 +12,7 @@ def all search_params = { changed_after: DateTime.new(1970, 1, 1) } - get_companies(search_params: changed_after, return_properties: return_props) + get_companies(search_params: search_params, return_properties: return_props) end private
Fix incorrect local variable reference
diff --git a/lib/ecc.rb b/lib/ecc.rb index abc1234..def5678 100644 --- a/lib/ecc.rb +++ b/lib/ecc.rb @@ -1,5 +1,109 @@ require "ecc/version" module Ecc - # Your code goes here... + + class Curve + + attr_accessor :a, :b, :fp + + def initialize(a, b, fp) + + @a = a + @b = b + @fp = fp + + raise "not elliptic curve" if 4 * (@a ** 3) + 27 * (@b ** 2) == 0 + + end + + def belong?(x,y) + + return (y ** 2) % @fp == (x ** 3 + @a * x + @b) % @fp + + end + + def point_order(x, y) + + p2 = Point.new(self, x, y) + + i = 2 + loop do + break if p * i == p2 + i += 1 + end + i + end + + end + + class Point + + attr_accessor :x, :y + + def initialize(curve, x, y) + + if curve.class != Curve + raise "1st argument type error" + end + + @curve = curve + @x = x + @y = y + + end + + def to_s + + "(#{@x}, #{@y})" + + end + + def zero? + + @x == 0 and @y == 0 + + end + + def ==(other) + + @x == other.x and @y == other.y + + end + + def +(other) + + u = Point.new(@ecc, self) if u.class != Point + v = Point.new(@ecc, other) if v.class != Point + + return u if v.zero? + return v if u.zero? + + lambda = nil + + if u != v + lambda = ((v.y - u.y) * (((v.x - u.x) ** (@fp - 2)) % @fp)) % @fp + else + lambda = ((3 * u.x ** 2 + @a) * (((2 * u.y) ** (@fp - 2)) % @fp)) % @fp + end + + x3 = lambda ** 2 - u.x - v.x + y3 = lambda * (u.x - x3) - u.y + Point.new(@ecc, [x3 % @fp, y3 % @fp]) + + end + + def *(d) + + sum = Point.new(@ecc, self) + + (d - 1).times do + sum = sum + self + end + + sum + + end + + end + end
UPDATE create Curve, Point class
diff --git a/db/data_migration/20170213113416_republish_publications_migration_one.rb b/db/data_migration/20170213113416_republish_publications_migration_one.rb index abc1234..def5678 100644 --- a/db/data_migration/20170213113416_republish_publications_migration_one.rb +++ b/db/data_migration/20170213113416_republish_publications_migration_one.rb @@ -1,8 +1,8 @@ document_scope = Document.where( - id: Publication.where(state: %w(draft published withdrawn)).pluck(:id) + id: Publication.where(state: %w(draft published withdrawn)).pluck(:document_id) ) -lowest_document_id_for_this_republish = 290000 +lowest_document_id_for_this_republish = 330000 document_scope = document_scope.where( "id > ?", lowest_document_id_for_this_republish ).order(id: :desc)
Update data migration to correctly republish Publications Need to use `document_id` not `id`
diff --git a/swftly.gemspec b/swftly.gemspec index abc1234..def5678 100644 --- a/swftly.gemspec +++ b/swftly.gemspec @@ -1,13 +1,14 @@ Gem::Specification.new do |spec| spec.name = 'swftly' - spec.version = '0.1.4' + spec.version = '0.1.42' spec.summary = "swftly abstracts and automates interactions with Swiffy, Google's hosted swf converter." spec.description = "swftly abstracts and automates interactions with Swiffy, Google's hosted swf converter." spec.platform = Gem::Platform::RUBY + spec.files = `git ls-files`.split("\n") + spec.test_files = `git ls-files -- {spec,features}/*`.split("\n") spec.require_paths = %w(lib) spec.authors = ["jnf"] spec.email = 'jeremy.flores@gmail.com' - spec.files = ["lib/swftly.rb", "lib/swftly/runtime.rb"] spec.homepage = 'https://github.com/jnf/swftly' spec.license = 'MIT'
Fix a problem causing exclusion of files in the built gem. Minor version bump.
diff --git a/rubygems-compile.gemspec b/rubygems-compile.gemspec index abc1234..def5678 100644 --- a/rubygems-compile.gemspec +++ b/rubygems-compile.gemspec @@ -2,8 +2,6 @@ s.name = 'rubygems-compile' s.version = '1.0.0' - s.required_rubygems_version = Gem::Requirement.new '>= 1.4.2' - s.rubygems_version = Gem::VERSION s.summary = 'A rubygems post-install hook using the MacRuby compiler to compile gems' s.description = <<-EOS @@ -28,8 +26,6 @@ s.email = 'mrada@marketcircle.com' s.homepage = 'http://github.com/ferrous26/rubygems-compile' s.licenses = ['MIT'] - s.has_rdoc = true - s.require_paths = ['lib'] s.files = Dir.glob('lib/**/*.rb') s.test_files = Dir.glob('test/**/test_*.rb') + ['test/helper.rb']
Remove unneeded spec attributes from the gemspec
diff --git a/app/helpers/component_helper.rb b/app/helpers/component_helper.rb index abc1234..def5678 100644 --- a/app/helpers/component_helper.rb +++ b/app/helpers/component_helper.rb @@ -1,6 +1,7 @@ module ComponentHelper def navigation_items return [] unless current_user + items = [] unless content_for(:suppress_navbar_items)
Add a blank line after a guard clause To improve the readability of the code.
diff --git a/app/helpers/needs_helper.rb b/app/helpers/needs_helper.rb index abc1234..def5678 100644 --- a/app/helpers/needs_helper.rb +++ b/app/helpers/needs_helper.rb @@ -2,7 +2,7 @@ def start_work_link need start_work = "http://#{Plek.current.panopticon}/artefacts/new" - form_tag start_work, :html => { :method => 'get' } do + form_tag start_work, :method => 'get' do [ hidden_field_tag("artefact[need_id]", need.id).html_safe, hidden_field_tag("artefact[kind]", need.kind.to_s.downcase).html_safe,
Use GET for asking for the new artefact form
diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb index abc1234..def5678 100644 --- a/app/jobs/application_job.rb +++ b/app/jobs/application_job.rb @@ -1,8 +1,6 @@ class ApplicationJob < ActiveJob::Base def self.aws_sqs_queue_url - Rails.configuration.app_settings.fetch("#{to_s.underscore}_queue_url") do - Rails.configuration.app_settings.fetch("default_queue_url") - end + Rails.configuration.app_settings["#{to_s.underscore}_queue_url"] || Rails.configuration.app_settings.fetch("default_queue_url") end queue_as(aws_sqs_queue_url)
Fix implementation of queue name
diff --git a/features/lib/support/env.rb b/features/lib/support/env.rb index abc1234..def5678 100644 --- a/features/lib/support/env.rb +++ b/features/lib/support/env.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true require 'aruba/cucumber' -require 'aruba/in_process' -require 'aruba/spawn_process' +require 'aruba/processes/in_process' +require 'aruba/processes/spawn_process' require 'cucumber/cli/main' Before('@spawn') do @@ -16,9 +16,6 @@ end Before do - # Make sure bin/cucumber runs with SimpleCov enabled - # set_env('SIMPLECOV', 'true') - # Set a longer timeout for aruba, and a really long one if running on JRuby @aruba_timeout_seconds = Cucumber::JRUBY ? 60 : 15 end
Remove deprecation notices from codebase by using newer aruba classes
diff --git a/dos_detector/dos_detector_worker_init.rb b/dos_detector/dos_detector_worker_init.rb index abc1234..def5678 100644 --- a/dos_detector/dos_detector_worker_init.rb +++ b/dos_detector/dos_detector_worker_init.rb @@ -1,2 +1,7 @@-Userdata.new.shared_cache = Cache.new :namespace =>"dos_detector", :size_mb=> 512 +config = {:namespace =>"dos_detector"} +c = Cache.new config +c.clear + +Userdata.new.shared_cache = c +
Clear cache which was created before
diff --git a/Casks/intellij-idea-ce-bundled-jdk.rb b/Casks/intellij-idea-ce-bundled-jdk.rb index abc1234..def5678 100644 --- a/Casks/intellij-idea-ce-bundled-jdk.rb +++ b/Casks/intellij-idea-ce-bundled-jdk.rb @@ -1,17 +1,19 @@ cask :v1 => 'intellij-idea-ce-bundled-jdk' do - version '14' - sha256 '09bb078252e2f6af6b58605ad3a380a71c8cc53f8e697e31fe03fcadb2152b07' + version '14.1' + sha256 '62c8b150ff82c31f2b6355a6f43b8ef69913b8f387cef6ddb4659622abb59a52' - url "http://download.jetbrains.com/idea/ideaIC-#{version}-jdk-bundled.dmg" + url "https://download.jetbrains.com/idea/ideaIC-#{version}-custom-jdk-bundled.dmg" + name 'IntelliJ IDEA' homepage 'https://www.jetbrains.com/idea/' - license :oss + license :apache - app "IntelliJ IDEA #{version} CE.app" - + app 'IntelliJ IDEA 14 CE.app' + zap :delete => [ - "~/Library/Application Support/IdeaIC#{version}", - "~/Library/Preferences/IdeaIC#{version}", - "~/Library/Caches/IdeaIC#{version}", - "~/Library/Logs/IdeaIC#{version}", + '~/Library/Preferences/com.jetbrains.intellij.ce.plist', + '~/Library/Preferences/IdeaIC14', + '~/Library/Application Support/IdeaIC14', + '~/Library/Caches/IdeaIC14', + '~/Library/Logs/IdeaIC14', ] end
Upgrade IntelliJ Idea CE with bundled JDK to 14.1 - Unify with other IntelliJ-based formulas (see #879)
diff --git a/sicuro.gemspec b/sicuro.gemspec index abc1234..def5678 100644 --- a/sicuro.gemspec +++ b/sicuro.gemspec @@ -12,7 +12,7 @@ s.summary = %q{Safe ruby code execution.} s.description = %q{Safe ruby code execution in a standard ruby environment. Does not use a chroot, jail, etc. No special permissions required.} - s.add_runtime_dependency 'standalone', '~> 0.1.0' + s.add_runtime_dependency 'standalone', '~> 0.3.0' s.add_development_dependency "rake", '~> 10.0.3' s.add_development_dependency 'rspec', '~> 2.13.0'
Update gemspec to use Standalone v0.3.0.
diff --git a/test/helper.rb b/test/helper.rb index abc1234..def5678 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -8,12 +8,19 @@ class MiniTest::Unit::TestCase include PrettyDiff::WordDiffFinder + class FixtureNotFoundError < StandardError; end + def new_diff(*args) PrettyDiff::Diff.new(*args) end def fixture(name) - File.read(File.join(File.dirname(__FILE__), "fixtures", name)) + path = File.join(File.dirname(__FILE__), "fixtures", name) + if File.exist?(path) + File.read(path) + else + raise FixtureNotFoundError.new("Fixture at path '#{path}' was not found") + end end def strip_word_indicators(text)
Raise error when fixture was not found.
diff --git a/fixtures/code/concurrent.rb b/fixtures/code/concurrent.rb index abc1234..def5678 100644 --- a/fixtures/code/concurrent.rb +++ b/fixtures/code/concurrent.rb @@ -2,7 +2,7 @@ Thread.current[:in_concurrent_rb] = true if t = Thread.current[:wait_for] - Thread.pass until t.backtrace && t.backtrace.any? { |call| call.include? 'require' } + Thread.pass until t.backtrace && t.backtrace.any? { |call| call.include? 'require' } && t.stop? end if Thread.current[:con_raise]
Fix spec to correctly wait for the thread to be waiting in the require lock
diff --git a/schema.gemspec b/schema.gemspec index abc1234..def5678 100644 --- a/schema.gemspec +++ b/schema.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |s| s.name = 'evt-schema' s.summary = "Primitives for schema and data structure" - s.version = '2.3.1.1' + s.version = '2.3.1.2' s.description = ' ' s.authors = ['The Eventide Project']
Package version is increased from 2.3.1.1 to 2.3.1.2
diff --git a/yard.gemspec b/yard.gemspec index abc1234..def5678 100644 --- a/yard.gemspec +++ b/yard.gemspec @@ -20,4 +20,6 @@ s.executables = ['yard', 'yardoc', 'yri'] s.license = 'MIT' if s.respond_to?(:license=) s.metadata['yard.run'] = 'yri' + + s.add_runtime_dependency 'webrick', '~> 1.7.0' end
Add webrick as runtime dependency WEBrick was removed as a core library in Ruby 3.0 Fixes #1387
diff --git a/semian.gemspec b/semian.gemspec index abc1234..def5678 100644 --- a/semian.gemspec +++ b/semian.gemspec @@ -16,14 +16,13 @@ s.email = 'scott.francis@shopify.com' s.license = 'MIT' - s.metadata['allowed_push_host'] = 'https://rubygems.org' - s.files = Dir['{lib,ext}/**/**/*.{rb,h,c}'] s.extensions = ['ext/semian/extconf.rb'] s.metadata = { + 'allowed_push_host' => 'https://rubygems.org', + 'bug_tracker_uri' => 'https://github.com/Shopify/semian/issues', 'changelog_uri' => 'https://github.com/Shopify/semian/blob/master/CHANGELOG.md', - 'bug_tracker_uri' => 'https://github.com/Shopify/semian/issues', 'source_code_uri' => 'https://github.com/Shopify/semian', } end
Move allowed_push_host in gemspec to all other metadata.
diff --git a/CreateSend.podspec b/CreateSend.podspec index abc1234..def5678 100644 --- a/CreateSend.podspec +++ b/CreateSend.podspec @@ -5,7 +5,7 @@ s.homepage = "http://campaignmonitor.github.io/createsend-objectivec/" s.license = { :type => "MIT", :file => "LICENSE" } s.authors = { "Nathan de Vries" => "nathan@atnan.com", "Jonathan Younger" => "jonathan@daikini.com", "James Dennes" => "jdennes@gmail.com" } - s.source = { :git => "https://github.com/campaignmonitor/createsend-objectivec.git", :tag => "v1.1.1" } + s.source = { :git => "https://github.com/campaignmonitor/createsend-objectivec.git", :tag => "v#{s.version}" } s.ios.deployment_target = "5.0" s.osx.deployment_target = "10.7" s.requires_arc = true
Use s.version to populate git tag in s.source.
diff --git a/app/models/call_data_record.rb b/app/models/call_data_record.rb index abc1234..def5678 100644 --- a/app/models/call_data_record.rb +++ b/app/models/call_data_record.rb @@ -27,8 +27,7 @@ self.direction = cdr.direction self.duration_sec = cdr.duration_sec self.bill_sec = cdr.bill_sec - save - logger.debug("CDR: #{self}, Errors: #{errors}") if errors.any? + save! end private
Remove logging but raise errors on validation
diff --git a/app/services/shared_markers.rb b/app/services/shared_markers.rb index abc1234..def5678 100644 --- a/app/services/shared_markers.rb +++ b/app/services/shared_markers.rb @@ -3,11 +3,11 @@ def autolink(link, _link_type) href = if ALLOWED_HOSTS_IN_MARKDOWN.include?(URI(link).host) - link - else - linkfilter_path(url: link) - end - + link + else + linkfilter_path(url: link) + end + content_tag(:a, link, href: href, target: "_blank", rel: "nofollow") rescue link
Apply review suggestion from @nilsding Co-authored-by: Georg Gadinger <9e8f1a26fbf401b045347f083556ffd7c0b25a58@nilsding.org>
diff --git a/test/db/sqlite3.rb b/test/db/sqlite3.rb index abc1234..def5678 100644 --- a/test/db/sqlite3.rb +++ b/test/db/sqlite3.rb @@ -1,8 +1,9 @@ require 'jdbc/sqlite3' if jruby? config = { - :adapter => jruby? ? 'jdbcsqlite3' : 'sqlite3', - :dbfile => 'test.sqlite3.db' + :adapter => jruby? ? 'jdbcsqlite3' : 'sqlite3', + :dbfile => 'test.sqlite3.db', + :database => 'test.sqlite3.db' # :url => 'jdbc:sqlite:test.sqlite3.db', # :driver => 'org.sqlite.JDBC' }
Add :database key for newer AR versions
diff --git a/spec/dummy/config/environments/development.rb b/spec/dummy/config/environments/development.rb index abc1234..def5678 100644 --- a/spec/dummy/config/environments/development.rb +++ b/spec/dummy/config/environments/development.rb @@ -11,7 +11,6 @@ # Show full error reports and disable caching config.consider_all_requests_local = true - config.action_view.debug_rjs = true config.action_controller.perform_caching = false # Don't care if the mailer can't send
Fix dummy app for rails 3.1
diff --git a/spec/models/achievement/forever_alone_spec.rb b/spec/models/achievement/forever_alone_spec.rb index abc1234..def5678 100644 --- a/spec/models/achievement/forever_alone_spec.rb +++ b/spec/models/achievement/forever_alone_spec.rb @@ -2,17 +2,4 @@ describe Achievement::ForeverAlone do it_should_behave_like "achievement" - let(:user) { Fabricate :user} - - describe "check" do - it "should call github and check there if positive" do - Github.should_receive(:forever_alone?).and_return false - described_class.check(user).should be_false - end - - it "should call github and check there if negative" do - Github.should_receive(:forever_alone?).and_return true - described_class.check(user).should be_true - end - end end
Fix specs for forever alone
diff --git a/spec/opsicle/question_asker/eip_asker_spec.rb b/spec/opsicle/question_asker/eip_asker_spec.rb index abc1234..def5678 100644 --- a/spec/opsicle/question_asker/eip_asker_spec.rb +++ b/spec/opsicle/question_asker/eip_asker_spec.rb @@ -7,18 +7,27 @@ let(:instance) do double(:instance, - elastic_ip: "example-hostname", - auto_scaling_type: ["type1", "type2"], + elastic_ip: nil, + auto_scaling_type: nil, status: "online", - hostname: "example" + hostname: "example", + instance_id: "instance-id" ) end - let(:opsworks_adapter) do - double(:opsworks_adapter, - instances_by_layer: [instance] + let(:client) do + double(:client, + opsworks: aws_opsworks_client ) end + + let(:aws_opsworks_client) do + double(:aws_opsworks_client, + describe_instances: double(:instances, instances: [instance]) + ) + end + + let(:opsworks_adapter) { Opsicle::OpsworksAdapter.new(client) } let(:eip_info) do { eip: true, ip_address: "ip-123", instance_name: "example-hostname", layer_id: "id1" } @@ -38,4 +47,12 @@ expect(eip_response).to eq(eip_info) end end + + describe "#which_instance_should_get_eip" do + let(:instance_response) { subject.which_instance_should_get_eip(eip_info) } + + it "should return a single instance" do + expect(instance_response).to eq("instance-id") + end + end end
Fix the tests for eip_asker
diff --git a/mirrors.rb b/mirrors.rb index abc1234..def5678 100644 --- a/mirrors.rb +++ b/mirrors.rb @@ -13,9 +13,14 @@ $stderr.puts " %s"%text end -while !(mirror = gets).nil? - mirror = mirror.split +while !(line = gets).nil? + mirror = line.split next if mirror.empty? + + if mirror[0][0] == '#' #This line is a comment + puts line + next + end name = mirror.shift @head = "Mirror '%s'"%name
mirror: Handle lines that are comments
diff --git a/app/models/ability.rb b/app/models/ability.rb index abc1234..def5678 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -0,0 +1,37 @@+class Ability + include CanCan::Ability + + def initialize(user) + user ||= User.new # guest user (not logged in) + + can :read, :all + can [:robots, :privacy, :terms], Application + can :create, Incident + can :create, Witness + can :create, Car + + if user.admin? + can :manage, :all + can [:edit_override_score, :update_override_score], Incident + end + + if user.mod? + can [:edit_override_score, :update_override_score], Incident + + can [:update, :destroy], Incident, user_id: user.id + can [:update, :destroy], Car, incident: { user_id: user.id } + can [:update, :destroy], Witness, incident: { user_id: user.id } + end + + if user.id.present? + can [:update, :destroy], Incident, user_id: user.id + can [:update, :destroy], Car, incident: { user_id: user.id } + can [:update, :destroy], Witness, incident: { user_id: user.id } + end + + if user.id.nil? + # TODO set permissions to allow edits of Incident, Car, and Witness entries + # that that IP created for 5 minutes after the created_at date + end + end +end
Define abilities for admin, mod, user, and anonymous guests
diff --git a/lib/analyze_assessments.rb b/lib/analyze_assessments.rb index abc1234..def5678 100644 --- a/lib/analyze_assessments.rb +++ b/lib/analyze_assessments.rb @@ -0,0 +1,39 @@+require 'csv' + +class AnalyzeAssessments < Struct.new(:path) + + def contents + encoding_options = { + invalid: :replace, + undef: :replace, + replace: '' + } + + @file ||= File.read(path).encode('UTF-8', 'binary', encoding_options) + .gsub(/\\\\/, '') + .gsub(/\\"/, '') + end + + def data + csv_options = { + headers: true, + header_converters: :symbol, + converters: ->(h) { nil_converter(h) } + } + + @parsed_csv ||= CSV.parse(contents, csv_options) + end + + def nil_converter(value) + value unless value == '\N' + end + + def dibels + data.select { |row| row[:asd_name].include?('DIBELS') } + end + + def access + data.select { |row| row[:asd_name].include?('ACCESS') } + end + +end
Add code for analyzing assessments data dump + Useful for asking questions about #16, #23
diff --git a/shanty.gemspec b/shanty.gemspec index abc1234..def5678 100644 --- a/shanty.gemspec +++ b/shanty.gemspec @@ -8,8 +8,8 @@ spec.version = Shanty::VERSION spec.authors = ["Andrew De Ponte"] spec.email = ["cyphactor@gmail.com"] - spec.summary = %q{TODO: Write a short summary. Required.} - spec.description = %q{TODO: Write a longer description. Optional.} + spec.summary = %q{Tool simplifying Vagrant based development & continuous integration environments.} + spec.description = %q{Shanty is focused on defining standards and building tooling around using Vagrant for development & continuous integration environments to make using them as easy as possible.} spec.homepage = "" spec.license = "MIT"
Set gem summary & description. I did this for a couple of reasons. First so that I could bundle install without bundler complaining about the TODO items in the gemspec. Second, I did this so that people would be able to see the description of the gem and understand what it is.
diff --git a/app/controllers/letter_bomb/mailers_controller.rb b/app/controllers/letter_bomb/mailers_controller.rb index abc1234..def5678 100644 --- a/app/controllers/letter_bomb/mailers_controller.rb +++ b/app/controllers/letter_bomb/mailers_controller.rb @@ -10,7 +10,7 @@ @action = params[:mailer_action] @mail = klass.constantize.preview_action(@action) - params[:format] ||= @mail.multipart? ? "html" : "text" + params[:format] ||= content_type_html? ? "html" : "text" respond_to do |format| format.html @@ -19,6 +19,10 @@ end private + + def content_type_html? + @mail.content_type.match("text/html") + end def body_part return @mail unless @mail.multipart?
Check message content type to determine default rendered format.
diff --git a/lib/factory_girl/rails2.rb b/lib/factory_girl/rails2.rb index abc1234..def5678 100644 --- a/lib/factory_girl/rails2.rb +++ b/lib/factory_girl/rails2.rb @@ -1 +1,7 @@-Rails.configuration.after_initialize { FactoryGirl.find_definitions } +Rails.configuration.after_initialize do + FactoryGirl.definition_file_paths = [ + File.join(Rails.root, 'test', 'factories'), + File.join(Rails.root, 'spec', 'factories') + ] + FactoryGirl.find_definitions +end
Add support back in for subdirectory requires. Poor old rails 2.x was forgotten about in fc8ce3ab7. Closes #65
diff --git a/lib/generators/derail/layout/layout_generator.rb b/lib/generators/derail/layout/layout_generator.rb index abc1234..def5678 100644 --- a/lib/generators/derail/layout/layout_generator.rb +++ b/lib/generators/derail/layout/layout_generator.rb @@ -24,5 +24,9 @@ copy_file "application.html.haml", "app/views/layouts/application.html.haml" copy_file "canvas.html.haml", "app/views/layouts/canvas.html.haml" end + + def insert_layout_into_application_controller + insert_into_file "app/controllers/application_controller.rb", "\n\n layout 'canvas'", :before => "\nend" + end end end
Add default layout to ApplicationController
diff --git a/lib/gitlab/satellite/files/delete_file_action.rb b/lib/gitlab/satellite/files/delete_file_action.rb index abc1234..def5678 100644 --- a/lib/gitlab/satellite/files/delete_file_action.rb +++ b/lib/gitlab/satellite/files/delete_file_action.rb @@ -0,0 +1,43 @@+require_relative 'file_action' + +module Gitlab + module Satellite + class DeleteFileAction < FileAction + # Deletes file and creates a new commit for it + # + # Returns false if committing the change fails + # Returns false if pushing from the satellite to bare repo failed or was rejected + # Returns true otherwise + def commit!(content, commit_message) + in_locked_and_timed_satellite do |repo| + prepare_satellite!(repo) + + # create target branch in satellite at the corresponding commit from bare repo + repo.git.checkout({raise: true, timeout: true, b: true}, ref, "origin/#{ref}") + + # update the file in the satellite's working dir + file_path_in_satellite = File.join(repo.working_dir, file_path) + File.delete(file_path_in_satellite) + + # add removed file + repo.add(file_path_in_satellite) + + # commit the changes + # will raise CommandFailed when commit fails + repo.git.commit(raise: true, timeout: true, a: true, m: commit_message) + + + # push commit back to bare repo + # will raise CommandFailed when push fails + repo.git.push({raise: true, timeout: true}, :origin, ref) + + # everything worked + true + end + rescue Grit::Git::CommandFailed => ex + Gitlab::GitLogger.error(ex.message) + false + end + end + end +end
Delete file action for satellites Signed-off-by: Dmitriy Zaporozhets <be23d75b156792e5acab51b196a2deb155d35d6a@gmail.com>
diff --git a/spec/payload/base_spec.rb b/spec/payload/base_spec.rb index abc1234..def5678 100644 --- a/spec/payload/base_spec.rb +++ b/spec/payload/base_spec.rb @@ -34,4 +34,14 @@ expect { Magnum::Payload::Base.new(nil) }.to raise_error "String or Hash required" end end + + describe '#skip' do + before do + Magnum::Payload::Base.any_instance.stub(:parse_payload) + end + + it 'should be false' do + Magnum::Payload::Base.new('data').skip.should eq false + end + end end
Add test for default skip value
diff --git a/Ashton.podspec b/Ashton.podspec index abc1234..def5678 100644 --- a/Ashton.podspec +++ b/Ashton.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "Ashton" - s.version = "0.1.2" + s.version = "0.1.5" s.summary = "Converts NSAttributedStrings between AppKit, CoreText, UIKit and HTML." s.homepage = "https://github.com/IdeasOnCanvas/Ashton" @@ -11,11 +11,13 @@ s.ios.deployment_target = '5.0' s.ios.frameworks = 'CoreText' - s.ios.source_files = FileList['Ashton/*.{h,m}'].exclude(/AppKit/) + s.ios.source_files = 'Ashton/*.{h,m}' + s.ios.exclude_files = 'Ashton/AshtonAppKit.{h,m}' s.osx.deployment_target = '10.7' s.osx.frameworks = 'CoreText' - s.osx.source_files = FileList['Ashton/*.{h,m}'].exclude(/UIKit/) + s.osx.source_files = 'Ashton/*.{h,m}' + s.osx.exclude_files = 'Ashton/AshtonUIKit.{h,m}' s.requires_arc = true end
Fix podspec to not use FileList and bump to 0.1.5
diff --git a/spec/support/overrides.rb b/spec/support/overrides.rb index abc1234..def5678 100644 --- a/spec/support/overrides.rb +++ b/spec/support/overrides.rb @@ -14,7 +14,9 @@ RSpec.configure do |config| config.before(:suite) do - TestResponse.send(:include, TestResponseStringOverride) + if defined?(TestResponse) + TestResponse.send(:include, TestResponseStringOverride) + end end end end
Fix bug with TestResponse override outside Rails When loading spec_helper instead of rails_helpers, ActionController::TestResponse is not defined.
diff --git a/lib/ey-core/cli/servers.rb b/lib/ey-core/cli/servers.rb index abc1234..def5678 100644 --- a/lib/ey-core/cli/servers.rb +++ b/lib/ey-core/cli/servers.rb @@ -4,20 +4,20 @@ module Core module Cli class Servers < Subcommand - title "servers" - summary "List servers you have access to" + title 'servers' + summary 'List servers you have access to' option :account, short: 'c', long: 'account', description: 'Filter by account name or id', - argument: 'Account' + argument: 'account' option :environment, - short: "-e", - long: "environment", - description: "Filter by environment.", - argument: "environment" + short: 'e', + long: 'environment', + description: 'Filter by environment.', + argument: 'environment' def handle puts TablePrint::Printer. @@ -27,13 +27,17 @@ private def servers - if option(:account) - core_client.servers.all(account: core_account) - elsif environment = option(:environment) - (core_client.environments.get(environment) || core_client.environments.first(name: environment)).servers.all - else - core_client.servers.all - end + filter_opts = {} + + operator = + if option(:environment) + core_account.environments.first(name: option(:environment)) + else + filter_opts[:account] = core_account.id if option(:account) + core_client + end + + operator ? operator.servers.all(filter_opts) : nil end end end
Fix account and environment filters The previous iteration returned an error when specifying an account. Furthermore, when a user has access to multiple accounts with multiple environments of the same name, the environments toggle would return only return the environment for the main account—and since the account couldn’t be set, this was problematic. Also, the environments short option has been fixed (“-e” has been changed to “e”).
diff --git a/lib/literate_randomizer.rb b/lib/literate_randomizer.rb index abc1234..def5678 100644 --- a/lib/literate_randomizer.rb +++ b/lib/literate_randomizer.rb @@ -42,7 +42,7 @@ end # correctly mirrors method_missing - def respond_to?(method) + def respond_to?(method, include_private = false) super || global.respond_to?(method) end end
Fix wrong number of arguments when trying to stub methods with rspec
diff --git a/lib/regaliator/response.rb b/lib/regaliator/response.rb index abc1234..def5678 100644 --- a/lib/regaliator/response.rb +++ b/lib/regaliator/response.rb @@ -1,3 +1,6 @@+require 'json' +require 'net/http' + module Regaliator class Response attr_reader :success @@ -20,4 +23,4 @@ !success? end end -end+end
Add missing requirements in Response. [ci skip]
diff --git a/lib/smitty/smtp_connect.rb b/lib/smitty/smtp_connect.rb index abc1234..def5678 100644 --- a/lib/smitty/smtp_connect.rb +++ b/lib/smitty/smtp_connect.rb @@ -0,0 +1,21 @@+require 'net/smtp' + +module Smitty + def self.smtp_connect(server, port, ssl, username, password) + begin + smtp_server = server.nil? ? 'localhost' : server + smtp_port = port.nil? ? 25 : port.to_i + smtp_conn = Net::SMTP.new(smtp_server, smtp_port) + smtp_conn.enable_tls() if ssl + if username + Smitty.croak('No password provided') if password.nil? + smtp_conn.start(smtp_server, username, password, :plain) + else + smtp_conn.start() + end + smtp_conn + rescue Exception => e + Smitty.croak("Could not connect to SMTP server #{smtp_server}:#{smtp_port}", e.message) + end + end +end
Put smtp connection login in separate function
diff --git a/lib/static-data/tasks.rake b/lib/static-data/tasks.rake index abc1234..def5678 100644 --- a/lib/static-data/tasks.rake +++ b/lib/static-data/tasks.rake @@ -27,7 +27,7 @@ StaticData.static_data_classes(Rails.root) do |static_data_class| StaticData.report_duration("== #{static_data_class}: updating", - "== #{static_data_class}: updating (%0.4fs)") do + "== #{static_data_class}: updated (%0.4fs)") do StaticData.report_duration("-- update", " -> %0.4fs") do results = static_data_class.update
Fix typo in progress messages
diff --git a/lib/toy_robot/direction.rb b/lib/toy_robot/direction.rb index abc1234..def5678 100644 --- a/lib/toy_robot/direction.rb +++ b/lib/toy_robot/direction.rb @@ -53,11 +53,9 @@ return unless facing? self.facing = (@facing + (t * TURN)) % TURN end + + directions.each_with_index do |d, i| + const_set(d, TURN * i / directions.length) + end end end - -ToyRobot::Direction.directions.each_with_index do |d, i| - ToyRobot::Direction.const_set( - d, ToyRobot::Direction::TURN * i / ToyRobot::Direction.directions.length - ) -end
Move constant creation into module
diff --git a/lib/simple_check_runner.rb b/lib/simple_check_runner.rb index abc1234..def5678 100644 --- a/lib/simple_check_runner.rb +++ b/lib/simple_check_runner.rb @@ -5,9 +5,15 @@ class << self def run_check(config, check, &block) - uri = URI(check[:url]) + uri = URI(check.url) start_time = Time.now - response = get_http(uri).request_get(uri) + http_client = get_http(uri) + response = case check.method + when "GET" + http_client.request_get(uri) + when "POST" + http_client.request_post(uri, check.data) + end duration = Time.now - start_time block.yield(start_time, duration, response.code, response.to_hash) end
Fix bug in Simple Checker and add POST support to it.
diff --git a/attributes/default.rb b/attributes/default.rb index abc1234..def5678 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -1,4 +1,4 @@-default["collectd"]["version"] = "5.1.1" +default["collectd"]["version"] = "5.4.0" default["collectd"]["dir"] = "/opt/collectd" default["collectd"]["url"] = "http://collectd.org/files/collectd-#{node["collectd"]["version"]}.tar.gz" default["collectd"]["checksum"] = "cb361deeda00bece54cec2f7a2c368ccea4ac1c4a83388a0dae0435ba8969ee1"
Update collectd version to 5.4.0
diff --git a/kpeg.gemspec b/kpeg.gemspec index abc1234..def5678 100644 --- a/kpeg.gemspec +++ b/kpeg.gemspec @@ -12,7 +12,10 @@ s.summary = %q{Peg-based Code Generator} s.description = %q{A tool for generating parsers using PEG} - s.files = ["LICENSE", "README.md", "Rakefile", "kpeg.gemspec", "Gemfile", "{lib,bin,doc}/**/*"].map{|p| Dir[p]}.flatten + rb = Dir["lib/**/*.rb"] << "bin/kpeg" + docs = Dir["doc/**/*"] + + s.files = rb + docs + ["LICENSE", "README.md", "Rakefile", "kpeg.gemspec", "Gemfile"] s.test_files = Dir["test/**/*.rb"] s.bindir = "bin" s.executables = ["kpeg"]
Fix files going into gemspec
diff --git a/effective_orders.gemspec b/effective_orders.gemspec index abc1234..def5678 100644 --- a/effective_orders.gemspec +++ b/effective_orders.gemspec @@ -18,7 +18,7 @@ s.add_dependency 'rails', '>= 4.0.0' s.add_dependency 'coffee-rails' s.add_dependency 'devise' - s.add_dependency 'sass-rails' + s.add_dependency 'sass' s.add_dependency 'effective_datatables', '>= 4.0.0' s.add_dependency 'effective_bootstrap' s.add_dependency 'effective_resources'
Drop sass-rails dependency, so sites can use sassc-rails or sass-rails.
diff --git a/tty-cursor.gemspec b/tty-cursor.gemspec index abc1234..def5678 100644 --- a/tty-cursor.gemspec +++ b/tty-cursor.gemspec @@ -6,13 +6,15 @@ spec.name = 'tty-cursor' spec.version = TTY::Cursor::VERSION spec.authors = ["Piotr Murach"] - spec.email = [""] + spec.email = ["me@piotrmurach.com"] spec.summary = %q{Terminal cursor positioning, visibility and text manipulation.} spec.description = %q{The purpose of this library is to help move the terminal cursor around and manipulate text by using intuitive method calls.} spec.homepage = 'http://piotrmurach.github.io/tty/' spec.license = "MIT" - spec.files = `git ls-files -z`.split("\x0") + spec.files = Dir['{lib,spec}/**/*.rb'] + spec.files += Dir['tasks/*', 'tty-cursor.gemspec'] + spec.files += Dir['README.md', 'CHANGELOG.md', 'LICENSE.txt', 'Rakefile'] spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"]
Change to load files directly
diff --git a/lib/active_scaffold/config/nested.rb b/lib/active_scaffold/config/nested.rb index abc1234..def5678 100644 --- a/lib/active_scaffold/config/nested.rb +++ b/lib/active_scaffold/config/nested.rb @@ -18,7 +18,10 @@ # Add a nested ActionLink def add_link(label, models, options = {}) - @core.action_links.add('nested', options.merge(:label => label, :type => :record, :security_method => :nested_authorized?, :position => :after, :parameters => {:associations => models.join(' ')}, :html_options => {:class => models.join(' ')})) + options.merge! :label => label, :type => :record, :security_method => :nested_authorized?, :position => :after, :parameters => {:associations => models.join(' ')} + options[:html_options] ||= {} + options[:html_options][:class] = [options[:html_options][:class], models.join(' ')].compact.join(' ') + @core.action_links.add('nested', options) end # the label for this Nested action. used for the header.
Allow to set html_options in add_link call
diff --git a/lib/dnsimple/struct/domain_record.rb b/lib/dnsimple/struct/domain_record.rb index abc1234..def5678 100644 --- a/lib/dnsimple/struct/domain_record.rb +++ b/lib/dnsimple/struct/domain_record.rb @@ -0,0 +1,40 @@+module Dnsimple + module Struct + + class DomainRecord < Base + # @return [Fixnum] The record ID in DNSimple. + attr_accessor :id + + # @return [Fixnum] The associated domain ID. + attr_accessor :domain_id + + # @return [Fixnum] The ID of the parent record, if this record is dependent on another record. + attr_accessor :parent_id + + # @return [String] The type of record, in uppercase. + attr_accessor :type + + # @return [String] The record name (without the domain name). + attr_accessor :name + + # @return [String] The plain-text record content. + attr_accessor :content + + # @return [Fixnum] The TTL value. + attr_accessor :ttl + + # @return [Fixnum] The priority value, if the type of record accepts a priority. + attr_accessor :priority + + # @return [Bool] True if this is a system record created by DNSimple. System records are read-only. + attr_accessor :system_record + + # @return [String] When the domain was created in DNSimple. + attr_accessor :created_at + + # @return [String] When the domain was last updated in DNSimple. + attr_accessor :updated_at + end + + end +end
Add the DomainRecord result type
diff --git a/lib/docile/fallback_context_proxy.rb b/lib/docile/fallback_context_proxy.rb index abc1234..def5678 100644 --- a/lib/docile/fallback_context_proxy.rb +++ b/lib/docile/fallback_context_proxy.rb @@ -21,8 +21,8 @@ # Special case to allow proxy instance variables def instance_variables - # Ruby 1.8.x returns string names, convert to symbols - super.map(&:to_sym) - NON_PROXIED_INSTANCE_VARIABLES.to_a + # Ruby 1.8.x returns string names, convert to symbols for compatibility + super.select { |v| !NON_PROXIED_INSTANCE_VARIABLES.include?(v.to_sym) } end def method_missing(method, *args, &block)
Modify 1.8.x compatibility fix to preserve original return type On 1.8.x, Object#instance_variables returns an array of strings, whereas it is an array of symbols on later versions. This minor change preserves that it is strings on 1.8.x
diff --git a/lib/komonjo/gateways/messages_gateway.rb b/lib/komonjo/gateways/messages_gateway.rb index abc1234..def5678 100644 --- a/lib/komonjo/gateways/messages_gateway.rb +++ b/lib/komonjo/gateways/messages_gateway.rb @@ -25,8 +25,8 @@ Komonjo::Model::Message.create(e).tap do |message| message.user = find_user(e[:user]) message.text = CGI.unescapeHTML(message.text) - message.partial_messages.each do |e| - e.embed(embed_data) + message.partial_messages.each do |partial| + partial.embed(embed_data) end end end
Rename a local variable which covers another
diff --git a/lib/generators/devise/orm_helpers.rb b/lib/generators/devise/orm_helpers.rb index abc1234..def5678 100644 --- a/lib/generators/devise/orm_helpers.rb +++ b/lib/generators/devise/orm_helpers.rb @@ -4,7 +4,8 @@ def model_contents <<-CONTENT # Include default devise modules. Others available are: - # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable + # :token_authenticatable, :encryptable, :confirmable, + # :lockable, :timeoutable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable
Apply the 80 chars per-line rule
diff --git a/lib/immortal/singular_association.rb b/lib/immortal/singular_association.rb index abc1234..def5678 100644 --- a/lib/immortal/singular_association.rb +++ b/lib/immortal/singular_association.rb @@ -12,6 +12,9 @@ private def deleted_reader(how, force_reload = false) + reset + reset_scope + klass.uncached do send(:"find_#{how}_deleted_target") end
Reset scope before calling deleted finder
diff --git a/spec/lib/i18n/hygiene/key_usage_checker_spec.rb b/spec/lib/i18n/hygiene/key_usage_checker_spec.rb index abc1234..def5678 100644 --- a/spec/lib/i18n/hygiene/key_usage_checker_spec.rb +++ b/spec/lib/i18n/hygiene/key_usage_checker_spec.rb @@ -10,8 +10,6 @@ it 'finds usage of pluralized key' - it 'does not find unused key' do - expect(I18n::Hygiene::KeyUsageChecker.new("unused.key").used_in_codebase?).to be false - end + it 'does not find unused key' end end
Mark this example as pending, ack/ag isn't happy
diff --git a/bin/utilities/output.rb b/bin/utilities/output.rb index abc1234..def5678 100644 --- a/bin/utilities/output.rb +++ b/bin/utilities/output.rb @@ -6,7 +6,7 @@ if raw or not $stdout.isatty @pager = nil elsif Shell.command_exist? 'less' - @pager = 'less -R -F' + @pager = 'less -R -F -X' elsif Shell.command_exist? 'more' @pager = 'more' end
Add X option to `less` Allows `less` to act like `cat` if the contents fit in one screen.
diff --git a/lib/tasks/fix_dangling_comments.rake b/lib/tasks/fix_dangling_comments.rake index abc1234..def5678 100644 --- a/lib/tasks/fix_dangling_comments.rake +++ b/lib/tasks/fix_dangling_comments.rake @@ -0,0 +1,20 @@+desc 'Removes comments with missing targets' +task :fix_dangling_comments do + [MergeRequest, MergeRequestVersion].each do |target| + table_name = target.table_name.to_sym + + comments = Comment.unscoped. + joins("LEFT OUTER JOIN #{table_name} ON #{table_name}.id = comments.target_id"). + where(:target_type => target.name, table_name => { :id => nil }) + + Rails.logger.debug "[fix_dangling_comments] removing #{comments.count} orphaned comments" + + comments.each do |comment| + begin + comment.destroy + rescue => e + comment.delete + end + end + end +end
Add task which removes dangling comments
diff --git a/mute.gemspec b/mute.gemspec index abc1234..def5678 100644 --- a/mute.gemspec +++ b/mute.gemspec @@ -20,4 +20,5 @@ spec.add_development_dependency 'bundler', '~> 1.5' spec.add_development_dependency 'rake', '~> 10.1.1' + spec.add_development_dependency 'rspec', '~> 2.14.1' end
Add rspec as development dependency
diff --git a/totem.gemspec b/totem.gemspec index abc1234..def5678 100644 --- a/totem.gemspec +++ b/totem.gemspec @@ -16,6 +16,4 @@ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) } gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) gem.require_paths = ["lib"] - - gem.add_dependency('raad', '0.5.0') end
Remove dependency on raad gem.
diff --git a/Casks/atom.rb b/Casks/atom.rb index abc1234..def5678 100644 --- a/Casks/atom.rb +++ b/Casks/atom.rb @@ -1,6 +1,6 @@ cask :v1 => 'atom' do - version '1.0.4' - sha256 '90cd22f9e6dfbfdfaa1bc79307c3abf1cf0ef4c07da31199f6e7ced11e0add8a' + version '1.0.5' + sha256 'ed4c55e059195111d9d12ec379849d8d3509062496fcf61102fc98d1ff8ba12e' # github.com is the official download host per the vendor homepage url "https://github.com/atom/atom/releases/download/v#{version}/atom-mac.zip"
Upgrade Atom to version 1.0.5.
diff --git a/Casks/epic.rb b/Casks/epic.rb index abc1234..def5678 100644 --- a/Casks/epic.rb +++ b/Casks/epic.rb @@ -7,7 +7,7 @@ name 'Epic Privacy Browser' appcast 'https://updates.epicbrowser.com/mac_updates/appcast.xml', :sha256 => '4249b7347d6edd78f8b421c8838c006731ab03477a6d17bd459cadb9519f4dc5' - homepage 'http://www.epicbrowser.com' + homepage 'https://www.epicbrowser.com/' license :gratis app 'Epic.app'
Fix homepage to use SSL in Epic Privacy Browser Cask The HTTP URL is already getting redirected to HTTPS. Using the HTTPS URL directly makes it more secure and saves a HTTP round-trip.
diff --git a/gatherer-scraper.gemspec b/gatherer-scraper.gemspec index abc1234..def5678 100644 --- a/gatherer-scraper.gemspec +++ b/gatherer-scraper.gemspec @@ -4,9 +4,12 @@ Gem::Specification.new do |gem| gem.authors = ["bigwheel"] gem.email = ["k.bigwheel+eng@gmail.com"] - gem.description = %q{TODO: Write a gem description} - gem.summary = %q{TODO: Write a gem summary} - gem.homepage = "" + gem.description = <<-EOS +Scrape Gatherer, Magic: The Gathering official card database +(http://gatherer.wizards.com/) and extract object form card data. +EOS + gem.summary = %q{Scrape Gatherer(MTG card database)} + gem.homepage = "http://github.com/bigwheel/gatherer-scraper" gem.files = `git ls-files`.split($\) gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
Add description to the gemspec file
diff --git a/kata2_ruby/bowling_game.rb b/kata2_ruby/bowling_game.rb index abc1234..def5678 100644 --- a/kata2_ruby/bowling_game.rb +++ b/kata2_ruby/bowling_game.rb @@ -15,21 +15,26 @@ def score total_score = 0 - is_spare = false - is_strike = false - @frames.each do |frame| + @frames.each_with_index do |frame, index| frame_score = frame.inject { |sum, n| sum + n } + is_spare = frame_score == 10 + is_strike = frame[0] == 10 if is_strike - total_score += frame_score * 2 + total_score += frame_score + next_two_scores(index) elsif is_spare - total_score += (frame[0] * 2) - total_score += frame[1] if frame.size > 1 + total_score += frame_score + next_score(index) else total_score += frame_score end - is_spare = frame_score == 10 - is_strike = frame[0] == 10 end total_score end + + def next_score(index) + 0 + end + + def next_two_scores(index) + 0 + end end
Refactor - 4 examples now failing
diff --git a/lib/intercode/import/intercode1/tables.rb b/lib/intercode/import/intercode1/tables.rb index abc1234..def5678 100644 --- a/lib/intercode/import/intercode1/tables.rb +++ b/lib/intercode/import/intercode1/tables.rb @@ -9,6 +9,8 @@ autoload :Con autoload :Events autoload :GMs, 'intercode/import/intercode1/tables/gms' + autoload :PreConEvents + autoload :PreConRuns autoload :PriceSchedule autoload :Runs autoload :Rooms
Load the new table importers
diff --git a/lib/lobbyist/v2/social_network_profile.rb b/lib/lobbyist/v2/social_network_profile.rb index abc1234..def5678 100644 --- a/lib/lobbyist/v2/social_network_profile.rb +++ b/lib/lobbyist/v2/social_network_profile.rb @@ -21,6 +21,10 @@ create_from_response(put("/v2/social-network-profiles/reset-facebook", params)) end + def self.reset_twitter(params = {}) + create_from_response(put("/v2/social-network-profiles/reset-twitter", params)) + end + end end
CA-4094: Add call to reset twitter connection
diff --git a/lib/cocoapods-core/http.rb b/lib/cocoapods-core/http.rb index abc1234..def5678 100644 --- a/lib/cocoapods-core/http.rb +++ b/lib/cocoapods-core/http.rb @@ -38,10 +38,14 @@ # @return [REST::response] # def self.validate_url(url) + if not url =~ /^#{URI.regexp}$/ + return nil + end + begin url = get_actual_url(url) resp = perform_head_request(url) - rescue + rescue SocketError resp = nil end
Validate URIs before making requests, only catch SocketErrors. This at least makes sure we do not mask errors (see #117).
diff --git a/spec/features/create_match_spec.rb b/spec/features/create_match_spec.rb index abc1234..def5678 100644 --- a/spec/features/create_match_spec.rb +++ b/spec/features/create_match_spec.rb @@ -0,0 +1,21 @@+require 'spec_helper' + +feature 'Create match' do + background do + @project = create(:project, state: 'online', online_date: -1.seconds.from_now) + login + end + + scenario 'generate new' do + visit project_path(@project) + click_on 'Match' + + fill_in 'projects_challenges_match_value', with: 2 + fill_in 'projects_challenges_match_starts_at', with: 1.day.from_now.strftime('%m/%d/%y') + fill_in 'projects_challenges_match_finishes_at', with: 3.days.from_now.strftime('%m/%d/%y') + fill_in 'projects_challenges_match_maximum_value', with: 20_000 + expect { + click_on 'Preview your match' + }.to change(Projects::Challenges::Match, :count).by(1) + end +end
Add acceptance spec for match creation
diff --git a/spec/features/registration_spec.rb b/spec/features/registration_spec.rb index abc1234..def5678 100644 --- a/spec/features/registration_spec.rb +++ b/spec/features/registration_spec.rb @@ -2,31 +2,43 @@ describe 'RegistrationForm' do feature 'Navigates Registration Form', js: true do + let!(:user) { User.create!(name: 'Matt', email: 'matt@matt.com', password: 'password') } it ' Shows the Form' do visit '/' click_on 'register' expect(page).to have_content 'New Account' end + it 'is able to click on the register button, not register' do visit '/' - sleep(1) click_on 'register' fill_in 'Full Name', with: 'Tester Name' fill_in 'Password', with: 'password' click_on 'Register' - expect(find('h2')).to have_content "New Account" + expect(find('ul')).to have_content "email can't be blank" end + + it 'is able to click on the register button, not register' do + visit '/' + click_on 'register' + fill_in 'Full Name', with: 'Tester Name' + fill_in 'Email', with: 'matt@matt.com' + fill_in 'Password', with: 'password' + click_on 'Register' + expect(find('ul')).to have_content "email has already been taken" + end + it 'is able to fill the register form, register and render the user show page' do visit '/' - sleep(1) click_on 'register' fill_in 'Full Name', with: 'Tester Name' fill_in 'Email', with: 'tester23@test.com' fill_in 'Password', with: 'password' click_on 'Register' - sleep(2) expect(find('.col-xs-10').find('h2')).to have_content('Your Meals') end + + end end
Test for registering with email already taken
diff --git a/lib/podio/models/stream_activity_group.rb b/lib/podio/models/stream_activity_group.rb index abc1234..def5678 100644 --- a/lib/podio/models/stream_activity_group.rb +++ b/lib/podio/models/stream_activity_group.rb @@ -1,6 +1,7 @@ # @see https://developers.podio.com/doc/stream class Podio::StreamActivityGroup < ActivePodio::Base + property :group_id, :integer property :kind, :string property :type, :string property :created_on, :datetime @@ -12,6 +13,8 @@ has_many :authors, :class => 'ByLine' + alias_method :id, :group_id + class << self def find_by_ref(ref_type, ref_id, options = {}) @@ -20,6 +23,12 @@ }.body end + def find_for_data_ref(ref_type, ref_id, data_ref_type, data_ref_id) + member Podio.connection.get { |req| + req.url("/stream/#{ref_type}/#{ref_id}/activity_group/#{data_ref_type}/#{data_ref_id}") + }.body + end + end end
Add method for getting group by data ref