diff
stringlengths 65
26.7k
| message
stringlengths 7
9.92k
|
|---|---|
diff --git a/spec/lib/rspec/helper_file_spec.rb b/spec/lib/rspec/helper_file_spec.rb
index abc1234..def5678 100644
--- a/spec/lib/rspec/helper_file_spec.rb
+++ b/spec/lib/rspec/helper_file_spec.rb
@@ -0,0 +1,18 @@+RSpec.describe Rambo::RSpec::HelperFile do
+ let(:template_path) {
+ File.expand_path("lib/rspec/templates/matcher_file_template.erb")
+ }
+
+ let(:file_path) {
+ File.expand_path("spec/support/matchers/rambo_matchers.rb")
+ }
+
+ subject { described_class.new(template_path: template_path, file_path: file_path) }
+
+ describe "generate" do
+ it "writes the file" do
+ expect(File).to receive(:write).with(file_path, File.read(template_path))
+ subject.generate
+ end
+ end
+end
|
Add test for HelperFile class
|
diff --git a/lib/shipping_materials/mixins/sortable.rb b/lib/shipping_materials/mixins/sortable.rb
index abc1234..def5678 100644
--- a/lib/shipping_materials/mixins/sortable.rb
+++ b/lib/shipping_materials/mixins/sortable.rb
@@ -6,7 +6,7 @@ def sort(context=:objects, &block)
@sorters ||= {}
@sorters[context] = Sorter.new
- @sorters[context].rule(&block)
+ @sorters[context].instance_eval(&block)
end
# Perform the sort
|
Revert a faulty bug fix
|
diff --git a/lib/deploy/sharing-files.rb b/lib/deploy/sharing-files.rb
index abc1234..def5678 100644
--- a/lib/deploy/sharing-files.rb
+++ b/lib/deploy/sharing-files.rb
@@ -13,4 +13,40 @@ end
end
-after "deploy:finalize_update", "deploy:app_symlinks"+after "deploy:finalize_update", "deploy:app_symlinks"
+
+namespace :deploy do
+ task :create_database_yml do
+ db_config = ERB.new <<-EOF
+ base: &base
+ adapter: postgresql
+ encoding: unicode
+ database: #{application}
+ pool: 5
+ min_messages: WARNING
+
+ #{rails_env}:
+ <<: *base
+
+ development:
+ <<: *base
+ EOF
+
+ run "mkdir -p #{shared_path}/config"
+ put db_config.result, "#{shared_path}/config/database.yml"
+
+ run "psql -c'create database #{application};' postgres"
+ end
+
+ task :create_shared_tmp_folder do
+ run "mkdir -p #{shared_path}/tmp"
+ end
+
+ task :fix_ssh_git do
+ run "echo 'StrictHostKeyChecking no' > ~/.ssh/config"
+ end
+end
+
+before 'deploy:setup', 'deploy:create_database_yml'
+before 'deploy:setup', 'deploy:create_shared_tmp_folder'
+before 'deploy:setup', 'deploy:fix_ssh_git'
|
Add more basic setup actions
|
diff --git a/lib/devise_userbin/hooks.rb b/lib/devise_userbin/hooks.rb
index abc1234..def5678 100644
--- a/lib/devise_userbin/hooks.rb
+++ b/lib/devise_userbin/hooks.rb
@@ -1,15 +1,23 @@-# After login
+# Everytime current_<scope> is prepared
#
-Warden::Manager.after_set_user :except => :fetch do |record, warden, opts|
+Warden::Manager.after_set_user :only => :fetch do |record, warden, opts|
+ scope = opts[:scope]
+
begin
- session = Userbin.with_context(warden.env) do
- Userbin::Session.post("/api/v1/users/#{record.userbin_id}/sessions")
- end
- warden.session(opts[:scope])['_ubt'] = session.id
+ warden.session(scope)['_ubt'] = Userbin.authenticate({
+ user_id: record.id,
+ properties: {
+ email: record.email
+ },
+ current: warden.session(scope)['_ubt']
+ })
rescue Userbin::ChallengeException => error
warden.session(opts[:scope])['_ubc'] = error.challenge.id
- rescue Userbin::Error
- # TODO: Proceed silently or report to browser?
+ rescue Userbin::Error => error
+ warden.session(scope).delete('_ubt')
+ warden.session(scope).delete('_ubc')
+ warden.logout(scope)
+ throw :warden, :scope => scope, :message => :timeout
end
end
@@ -17,33 +25,7 @@ #
Warden::Manager.before_logout do |record, warden, opts|
begin
- if session_id = warden.session(opts[:scope]).delete('_ubt')
- Userbin.with_context(warden.env) do
- Userbin::Session.destroy_existing(session_id)
- end
- end
+ Userbin.deauthenticate(warden.session(opts[:scope]).delete('_ubt'))
rescue Userbin::Error; end
end
-# Everytime current_<scope> is prepared
-#
-Warden::Manager.after_set_user :only => :fetch do |record, warden, opts|
- scope = opts[:scope]
- session_id = warden.session(scope)['_ubt']
-
- if session_id
- begin
- if Userbin::JWT.new(session_id).expired?
- session = Userbin.with_context(warden.env) do
- Userbin::Session.new(id: session_id).refresh
- end
- warden.session(scope)['_ubt'] = session.id
- end
- rescue Userbin::Error
- warden.session(scope).delete('_ubt')
- warden.session(scope).delete('_ubc')
- warden.logout(scope)
- throw :warden, :scope => scope, :message => :timeout
- end
- end
-end
|
Use new top-level API from userbin-ruby
|
diff --git a/carrierwave-aws.gemspec b/carrierwave-aws.gemspec
index abc1234..def5678 100644
--- a/carrierwave-aws.gemspec
+++ b/carrierwave-aws.gemspec
@@ -17,7 +17,7 @@ gem.require_paths = ['lib']
gem.add_dependency 'carrierwave', '~> 0.7'
- gem.add_dependency 'aws-sdk', '~> 1.58'
+ gem.add_dependency 'aws-sdk', '~> 2.0.47'
gem.add_development_dependency 'rspec', '~> 3'
end
|
Upgrade aws-sdk to latest in the 2.0 line
|
diff --git a/lib/frontend_generators.rb b/lib/frontend_generators.rb
index abc1234..def5678 100644
--- a/lib/frontend_generators.rb
+++ b/lib/frontend_generators.rb
@@ -2,6 +2,14 @@
module FrontendGenerators
class Bootstrap
+
+ def run
+
+ end
+
+ def bootstrap_css
+ File.join(root, "assets", "bootstrap", "bootstrap.css")
+ end
def root
File.expand_path("../", File.dirname(__FILE__))
|
Write a couple of methods to get paths
|
diff --git a/lib/paypoint/blue/utils.rb b/lib/paypoint/blue/utils.rb
index abc1234..def5678 100644
--- a/lib/paypoint/blue/utils.rb
+++ b/lib/paypoint/blue/utils.rb
@@ -7,7 +7,7 @@ def snakecase_and_symbolize_keys(hash)
case hash
when Hash
- hash.each_with_object({},) do |(key, value), snakified|
+ hash.each_with_object({}) do |(key, value), snakified|
snakified[snakecase(key)] = snakecase_and_symbolize_keys(value)
end
when Enumerable
@@ -20,7 +20,7 @@ def camelcase_and_symbolize_keys(hash)
case hash
when Hash
- hash.each_with_object({},) do |(key, value), camelized|
+ hash.each_with_object({}) do |(key, value), camelized|
camelized[camelcase(key)] = camelcase_and_symbolize_keys(value)
end
when Enumerable
@@ -29,8 +29,6 @@ hash
end
end
-
- private
def snakecase(original)
string = original.is_a?(Symbol) ? original.to_s : original.dup
|
Fix a method visibility issue with `module_function`
|
diff --git a/lib/rspec/parameterized.rb b/lib/rspec/parameterized.rb
index abc1234..def5678 100644
--- a/lib/rspec/parameterized.rb
+++ b/lib/rspec/parameterized.rb
@@ -2,5 +2,16 @@
module RSpec
module Parameterized
+ module ExampleGroupMethods
+ def where(&b)
+ puts "here"
+ end
+ end
+ end
+
+ module Core
+ class ExampleGroup
+ extend ::RSpec::Parameterized::ExampleGroupMethods
+ end
end
end
|
Add where to example group methods
|
diff --git a/lib/stacks/shiny_server.rb b/lib/stacks/shiny_server.rb
index abc1234..def5678 100644
--- a/lib/stacks/shiny_server.rb
+++ b/lib/stacks/shiny_server.rb
@@ -0,0 +1,15 @@+require 'stacks/namespace'
+require 'stacks/machine_def'
+
+class Stacks::ShinyServer < Stacks::MachineDef
+ def initialize(virtual_service, index)
+ @virtual_service = virtual_service
+ super(virtual_service.name + "-" + index)
+ end
+
+ def to_enc
+ {
+ 'role::shiny_server' => {}
+ }
+ end
+end
|
Add incredibly simple shiny server stack
|
diff --git a/lib/tasks/application.rake b/lib/tasks/application.rake
index abc1234..def5678 100644
--- a/lib/tasks/application.rake
+++ b/lib/tasks/application.rake
@@ -12,18 +12,26 @@ loader.load_all
end
+ desc 'Update all the caches'
+ task :update_caches => [:update_member_distances_cache, :update_whip_cache,
+ :update_member_cache, :update_division_cache] do
+ end
+
desc 'Update cache of guessed whips'
task :update_whip_cache => :environment do
+ puts "Updating cache of guessed whips..."
Whip.update_all!
end
desc "Update cache of member attendance, rebellions, etc"
- task :update_member_cache => :environment do
+ task :update_member_cache => :update_whip_cache do
+ puts "Updating member cache..."
MemberInfo.update_all!
end
desc "Update cache of division attendance, rebellions, etc"
- task :update_division_cache => :environment do
+ task :update_division_cache => :update_whip_cache do
+ puts "Updating division cache..."
DivisionInfo.update_all!
end
end
|
Add rake task for updating all caches and set dependencies
|
diff --git a/rails/spec/requests/account_controller_spec.rb b/rails/spec/requests/account_controller_spec.rb
index abc1234..def5678 100644
--- a/rails/spec/requests/account_controller_spec.rb
+++ b/rails/spec/requests/account_controller_spec.rb
@@ -27,7 +27,7 @@ it { compare url, true }
context "new passwords don't match" do
- it { compare_post url, true, submit: 'Change My Password', new_password1: 'foobar', new_password2: 'barfoo' }
+ it { compare_post url, true, submit: 'Change My Password', old_password: 'password', new_password1: 'some_password', new_password2: 'another_password' }
end
end
end
|
Change example passwords to make it clearer what we're testing
|
diff --git a/lib/lighter/lamp_control.rb b/lib/lighter/lamp_control.rb
index abc1234..def5678 100644
--- a/lib/lighter/lamp_control.rb
+++ b/lib/lighter/lamp_control.rb
@@ -26,11 +26,11 @@ end
def fadeData(lamps, length, cols)
- [mode(lamps,FADE), cols[0].to_i, cols[1].to_i, cols[2].to_i, length]
+ [mode(lamps,FADE), *cols, length]
end
def setData(lamps, cols)
- [mode(lamps,SET), cols[0].to_i, cols[1].to_i, cols[2].to_i]
+ [mode(lamps,SET), *cols]
end
end
|
Refactor arrays with splat (*)
|
diff --git a/lib/quickeebooks/logging.rb b/lib/quickeebooks/logging.rb
index abc1234..def5678 100644
--- a/lib/quickeebooks/logging.rb
+++ b/lib/quickeebooks/logging.rb
@@ -35,6 +35,8 @@ end
end
+ extend Logging::ClassMethods
+
class << self
attr_accessor :log_to
attr_accessor :log_formatter_class
|
Add back global Quickeebooks.logger method
This makes it possible to easily use the logger that Quickeebooks is using
outside of Quickeebooks itself.
|
diff --git a/lib/virtus/configuration.rb b/lib/virtus/configuration.rb
index abc1234..def5678 100644
--- a/lib/virtus/configuration.rb
+++ b/lib/virtus/configuration.rb
@@ -9,7 +9,6 @@ @coercer = Coercible::Coercer.new
end
- def call(&block)
yield self if block_given?
self
end
|
Remove unused block capture in Configuration
|
diff --git a/app/controllers/contact_controller.rb b/app/controllers/contact_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/contact_controller.rb
+++ b/app/controllers/contact_controller.rb
@@ -1,5 +1,52 @@ class ContactController < ApplicationController
+ def date_count(var_date)
+ str = ''
+ date1 = var_date
+ diff = Time.now.to_i - date1.to_time.to_i
+ in_days = diff / (60*60*24) # full amount of days
+ years = diff / (365*60*60*24)
+ months = (diff - years * 365*60*60*24) / (30*60*60*24)
+ days = (diff - years * 365*60*60*24 - months*30*60*60*24)/ (60*60*24) # XXXX.XX.XX - years - months = days
+
+ if years != 0
+ str = str + years.to_s + ' years '
+ end
+ if months != 0
+ str = str + months.to_s + ' months '
+ end
+ if days == 1
+ str = str + days.to_s + ' day ago'
+ elsif days != 0
+ str = str + days.to_s + ' days ago'
+ else
+ str = str + 'less than 1 day ago'
+ end
+
+ result = {
+ 'date_diff' => str,
+ 'years' => years,
+ 'months' => months,
+ 'days' => days,
+ 'in_days' => in_days
+ }
+ end
+
def show
- @color = "green"
+ #Contact.all.each do |c|
+
+ @red = 30
+ date_array = date_count("2012-01-26")
+
+
+ if @red == 0
+ @color = "green"
+ elsif date_array["in_days"] > @red
+ @color = "red"
+ elsif date_array["in_days"] > @red / 2
+ @color = "yellow"
+ else
+ @color = "green"
+ end
+
end
-end
+end
|
Define date diff. First step.
|
diff --git a/app/controllers/lessons_controller.rb b/app/controllers/lessons_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/lessons_controller.rb
+++ b/app/controllers/lessons_controller.rb
@@ -23,6 +23,19 @@ respond_with_bip @lesson
end
+ def update_file_attachment
+ @lesson = @course.lessons.find params[:lesson_id]
+
+ authorize! :update, @lesson
+
+ unless @lesson.update_attributes params[:lesson]
+ flash[:error] = "File attachment '#{@lesson.file_attachment.original_filename}' content type unsupported."
+ @lesson.reload
+ end
+
+ flash.discard
+ end
+
private
def get_course
|
Add File Upload Action for LessonsController
Update the LessonsController to add a file upload action to handle file
uploads.
|
diff --git a/app/controllers/schools_controller.rb b/app/controllers/schools_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/schools_controller.rb
+++ b/app/controllers/schools_controller.rb
@@ -4,61 +4,13 @@ # GET /schools
# GET /schools.json
def index
- @schools = School.all
+ @district = District.find(params[:district_id])
+ @schools = @district.schools
end
# GET /schools/1
# GET /schools/1.json
def show
- end
-
- # GET /schools/new
- def new
- @school = School.new
- end
-
- # GET /schools/1/edit
- def edit
- end
-
- # POST /schools
- # POST /schools.json
- def create
- @school = School.new(school_params)
-
- respond_to do |format|
- if @school.save
- format.html { redirect_to @school, notice: 'School was successfully created.' }
- format.json { render :show, status: :created, location: @school }
- else
- format.html { render :new }
- format.json { render json: @school.errors, status: :unprocessable_entity }
- end
- end
- end
-
- # PATCH/PUT /schools/1
- # PATCH/PUT /schools/1.json
- def update
- respond_to do |format|
- if @school.update(school_params)
- format.html { redirect_to @school, notice: 'School was successfully updated.' }
- format.json { render :show, status: :ok, location: @school }
- else
- format.html { render :edit }
- format.json { render json: @school.errors, status: :unprocessable_entity }
- end
- end
- end
-
- # DELETE /schools/1
- # DELETE /schools/1.json
- def destroy
- @school.destroy
- respond_to do |format|
- format.html { redirect_to schools_url, notice: 'School was successfully destroyed.' }
- format.json { head :no_content }
- end
end
private
|
Add district variable to index method, remove new, create, edit, update, destroy methods
|
diff --git a/app/controllers/v_cards_controller.rb b/app/controllers/v_cards_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/v_cards_controller.rb
+++ b/app/controllers/v_cards_controller.rb
@@ -1,7 +1,6 @@ class VCardsController < ApplicationController
def show
- return unless params[:id]
- @office = OfficeLocation.find_with_rep(params[:id]).first
+ @office = OfficeLocation.find_with_rep(params.require(:id)).first
@rep = @office.rep
send_data @office.v_card, filename: "#{@rep.official_full} #{@rep.state.abbr}.vcf"
|
Use params.require to respond with Bad Request should id parameter not be included in request
|
diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/welcome_controller.rb
+++ b/app/controllers/welcome_controller.rb
@@ -2,5 +2,10 @@ layout 'home'
def index
+ if request.host == 'activities.fairwoodexplorer.org'
+ redirect_to 'http://apps.fairwoodexplorer.org/activities'
+ elsif request.host == 'walkathon.fairwoodexplorer.org'
+ redirect_to 'http://apps.fairwoodexplorer.org/walkathon'
+ end
end
end
|
Add top-level redirects to /activities and /walkathon if a user's url is activities.fairwoodexplorer.org or walkathon.fairwoodexplorer.org
|
diff --git a/lib/cineworld_uk/version.rb b/lib/cineworld_uk/version.rb
index abc1234..def5678 100644
--- a/lib/cineworld_uk/version.rb
+++ b/lib/cineworld_uk/version.rb
@@ -1,3 +1,6 @@+# Ruby interface for http://www.cineworld.co.uk
+# @version 0.0.1
module CineworldUk
+ # Gem version
VERSION = "0.0.1"
end
|
Document how we mean to go on
|
diff --git a/app/models/spree/variant_decorator.rb b/app/models/spree/variant_decorator.rb
index abc1234..def5678 100644
--- a/app/models/spree/variant_decorator.rb
+++ b/app/models/spree/variant_decorator.rb
@@ -5,6 +5,7 @@ validates :sku, 'spree_fishbowl/sku_in_fishbowl' => true, :if => "sku.present?"
alias_method :orig_on_hand, :on_hand
+ alias_method :orig_on_hand=, :on_hand=
def on_hand
return orig_on_hand if (!SpreeFishbowl.enabled? || !sku)
@@ -18,7 +19,9 @@ end
def on_hand=(new_level)
- # no-op
+ return orig_on_hand=(new_level) if !SpreeFishbowl.enabled?
+
+ # no-op otherwise
end
end
|
Allow setting inventory when Fishbowl integration is disabled
|
diff --git a/core/file/absolute_path_spec.rb b/core/file/absolute_path_spec.rb
index abc1234..def5678 100644
--- a/core/file/absolute_path_spec.rb
+++ b/core/file/absolute_path_spec.rb
@@ -17,8 +17,15 @@ end
end
- it "doesn't expand '~'" do
+ it "does not expand '~' to a home directory." do
File.absolute_path('~').should_not == File.expand_path('~')
+ end
+
+ it "does not expand '~user' to a home directory." do
+ path = File.dirname(@abs)
+ Dir.chdir(path) do
+ File.absolute_path('~user').should == File.join(path, '~user')
+ end
end
it "accepts a second argument of a directory from which to resolve the path" do
|
Add spec for receiving '~user' in File.absolute_path.
|
diff --git a/spec/models/site_spec.rb b/spec/models/site_spec.rb
index abc1234..def5678 100644
--- a/spec/models/site_spec.rb
+++ b/spec/models/site_spec.rb
@@ -1,12 +1,10 @@ require 'rails_helper'
-RSpec.describe Site, 'site attribut testing' do
- it 'cannot save without a name' do
- site = build(:site, name: nil)
- result = site.save
- expect(result).to be false
- end
+RSpec.describe Site, "validations" do
+ it { is_expected.to validate_presence_of(:name) }
+end
+RSpec.describe Site, 'obsolete association testing' do
it 'can have many tracks' do
site = build(:site, :has_tracks)
expect(site.tracks.count).to eq(3)
|
Update site spec with shoulda gem
|
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index abc1234..def5678 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -8,6 +8,7 @@
it { is_expected.to have_many(:languages)}
it { is_expected.to have_many(:abilities)}
+ it { is_expected.to define_enum_for(:locale).with([:de, :en])}
describe 'validations' do
it 'is invalid without email' do
|
Add spec to check the user defines locale enum
The two expected values are German and English.
|
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index abc1234..def5678 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -2,4 +2,40 @@
RSpec.describe User, type: :model do
it { should validate_presence_of(:name) }
+
+ context "sign in with omniauth" do
+ let(:exists_user) { FactoryGirl.create(:user) }
+ let(:auth_info) {
+ OmniAuth::AuthHash.new({
+ provider: 'github',
+ info: {
+ email: 'github@5xruby.tw'
+ }
+ })
+ }
+
+ let(:auth_info_exists) {
+ OmniAuth::AuthHash.new({
+ provider: 'github',
+ info: {
+ email: exists_user.email
+ }
+ })
+ }
+
+ it "should create new user when not found" do
+ user_count = User.count
+ User.from_omniauth(auth_info)
+ expect(user_count).not_to eq(User.count)
+ end
+
+ it "should return exists user when found" do
+ expect(User.from_omniauth(auth_info_exists)).to eq(exists_user)
+ end
+ end
+
+ context "with default information from session" do
+ it "should copy github information"
+ it "should copy twitter information"
+ end
end
|
Add omniauth relate test for user model
|
diff --git a/test/cookbooks/rabbitmq_test/recipes/default.rb b/test/cookbooks/rabbitmq_test/recipes/default.rb
index abc1234..def5678 100644
--- a/test/cookbooks/rabbitmq_test/recipes/default.rb
+++ b/test/cookbooks/rabbitmq_test/recipes/default.rb
@@ -19,10 +19,7 @@ # limitations under the License.
#
-case node['platform_family']
-when 'debian', 'ubuntu'
- apt_update
-end
+apt_update if platform_family?('debian')
chef_gem 'bunny' do
action :install
|
Simplify a platform family check in the test recipe
Ubuntu isn't a platform family and we have a nice helper for this
Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
|
diff --git a/spec/unit/client_spec.rb b/spec/unit/client_spec.rb
index abc1234..def5678 100644
--- a/spec/unit/client_spec.rb
+++ b/spec/unit/client_spec.rb
@@ -15,6 +15,11 @@ invalid_url = 'I am not a valid URL'
expect{Client.new invalid_url}.to raise_error(URI::InvalidURIError)
end
+
+ end
+
+ it 'fails, just to see how Travis reports it' do
+ raise "Let's see how Travis reports a failure"
end
end
|
Introduce spurious test failure to test Travis failure reporting
|
diff --git a/lib/geocoder/models/base.rb b/lib/geocoder/models/base.rb
index abc1234..def5678 100644
--- a/lib/geocoder/models/base.rb
+++ b/lib/geocoder/models/base.rb
@@ -9,7 +9,11 @@ module Base
def geocoder_options
- @geocoder_options
+ if defined?(@geocoder_options)
+ @geocoder_options
+ elsif superclass.respond_to?(:geocoder_options)
+ superclass.geocoder_options
+ end
end
def geocoded_by
|
Fix single table inheritance bug.
Child classes didn't have access to parent's configuration. This is kind
of crude (if geocoder_options not defined, see parent) but it works.
|
diff --git a/lib/forge/cli.rb b/lib/forge/cli.rb
index abc1234..def5678 100644
--- a/lib/forge/cli.rb
+++ b/lib/forge/cli.rb
@@ -26,8 +26,8 @@ project = Forge::Project.create(dir, config, self)
end
- desc "preview", "Start preview process"
- def preview
+ desc "watch", "Start watch process"
+ def watch
project = Forge::Project.new('.', self)
Forge::Guard.start(project, self)
|
Rename preview task to watch
|
diff --git a/lib/bigfloat/bigdecimal.rb b/lib/bigfloat/bigdecimal.rb
index abc1234..def5678 100644
--- a/lib/bigfloat/bigdecimal.rb
+++ b/lib/bigfloat/bigdecimal.rb
@@ -1,6 +1,7 @@ # This adds some extensions to BigDecimal for (limited) compatibility with BigFloat types
-# require 'bigdecimal'
+require 'bigdecimal'
+require 'bigdecimal/math'
class BigDecimal
@@ -56,4 +57,8 @@ end
end
+ module Math
+ extend BigMath
+ end
+
end
|
Add BigDecimal::Math to simplify use of BigDecimal math functions.
|
diff --git a/spec/controllers/challenges_controller_spec.rb b/spec/controllers/challenges_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/challenges_controller_spec.rb
+++ b/spec/controllers/challenges_controller_spec.rb
@@ -2,69 +2,6 @@
describe ChallengesController do
- # let!(:user) { User.create!(first_name: "Karl", last_name: "Thomas", email: "karl@karl.com", phone: "555-555-5555", username: "KThomas", password: "password") }
- # let!(:challenge) { Challenge.create!(description: "This is a challenge", price: 1000, challenger_id: 1, acceptor_id: 1, witness_id: 1, winner_id: 1)}
-
- # describe "GET #new" do
- # it "responds with status code 200" do
- # get :new
- # expect(response).to have_http_status(200)
- # end
-
- # it "assigns a new user to @user" do
- # get :new
- # expect(assigns(:challenge)).to be_a_new Challenge
- # end
-
- # it "renders the :new template" do
- # get :new
- # expect(response).to render_template(:new)
- # end
- # end
-
- # describe "GET #show" do
- # it "responds with status code 200" do
- # get :show, { id: challenge.id }
- # expect(response).to have_http_status(200)
- # end
-
- # it "renders the :show template" do
- # get :show, { id: challenge.id }
- # expect(response).to render_template(:show)
- # end
- # end
-
- # describe "GET #edit" do
- # it "responds with status code 200" do
- # get :edit, { id: challenge.id }
- # expect(response).to have_http_status(200)
- # end
-
- # it "renders the :edit template" do
- # get :edit, { id: challenge.id }
- # expect(response).to render_template(:edit)
- # end
- # end
-
- # describe "POST #create" do
-
- # end
-
- # describe "PUT #update" do
-
- # end
-
- # describe "DELETE #destroy" do
-
- # it "responds with status code 200" do
- # expect{ delete :destroy, { id: challenge.id } }.to change(Challenge, :count).by(-1)
- # end
-
- # it "redirects to the user profile page" do
- # delete :destroy, { id: challenge.id }
- # response.should redirect_to(root_path)
- # end
- # end
end
|
Remove all challenge controller tests
|
diff --git a/lib/dm-address/zip_code.rb b/lib/dm-address/zip_code.rb
index abc1234..def5678 100644
--- a/lib/dm-address/zip_code.rb
+++ b/lib/dm-address/zip_code.rb
@@ -1,6 +1,6 @@ module DataMapper
module Address
- class ZipCode < String
+ class ZipCode < String
# Remove all non-digits from given zip code
def initialize(s)
super((s || '').gsub(/\D+/, ''))
|
Remove some extra spaces in ZipCode (it was annoying me)
|
diff --git a/lib/identity/heroku_api.rb b/lib/identity/heroku_api.rb
index abc1234..def5678 100644
--- a/lib/identity/heroku_api.rb
+++ b/lib/identity/heroku_api.rb
@@ -7,12 +7,13 @@ "Accept" => "application/vnd.heroku+json; version=3"
}.merge(options[:headers] || {})
if options[:user] || options[:pass]
- authorization = Base64.urlsafe_encode64(
- "#{options[:user] || ''}:#{options[:pass] || ''}")
+ authorization = ["#{options[:user] || ''}:#{options[:pass] || ''}"].
+ pack('m').delete("\r\n")
headers["Authorization"] = "Basic #{authorization}"
elsif options[:authorization]
headers["Authorization"] = options[:authorization]
end
+ Slides.log :ACTION, headers
super(Config.heroku_api_url, headers: headers,
instrumentor: ExconInstrumentor.new(id: options[:request_id]))
end
|
CHANGE STUFF TO FIND BUG
|
diff --git a/motion-screenshots.gemspec b/motion-screenshots.gemspec
index abc1234..def5678 100644
--- a/motion-screenshots.gemspec
+++ b/motion-screenshots.gemspec
@@ -19,8 +19,9 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
- spec.add_dependency "motion-cocoapods", ">= 1.4.0"
- spec.add_dependency "motion-env", ">= 0.0.3"
-
+ spec.add_dependency "motion-cocoapods", ">= 1.7.0"
+ spec.add_dependency "motion-env", ">= 0.0.4"
+ spec.add_dependency "plist", ">= 3.1.0"
+
spec.add_development_dependency "rake"
end
|
Add dependency to plist gem and bump others to working versions.
|
diff --git a/lib/rom/yaml/repository.rb b/lib/rom/yaml/repository.rb
index abc1234..def5678 100644
--- a/lib/rom/yaml/repository.rb
+++ b/lib/rom/yaml/repository.rb
@@ -7,13 +7,17 @@ module YAML
# YAML repository
#
+ # Connects to a yaml file and uses it as a data-source
+ #
# @example
- # repository = ROM::YAML::Repository.new('/path/to/data.yml')
- # repository.dataset(:users)
+ # ROM.setup(:yaml, '/path/to/data.yml')
+ #
+ # rom = ROM.finalize.env
+ #
+ # repository = rom.repositories[:default]
+ #
# repository.dataset?(:users) # => true
- # repository[:users]
- #
- # Connects to a yaml file and use it as a data-source
+ # repository[:users] # => data under 'users' key from the yaml file
#
# @api public
class Repository < ROM::Repository
|
Change repo example in yard docs [ci skip]
|
diff --git a/lib/fog/bin/hp.rb b/lib/fog/bin/hp.rb
index abc1234..def5678 100644
--- a/lib/fog/bin/hp.rb
+++ b/lib/fog/bin/hp.rb
@@ -0,0 +1,40 @@+class HP < Fog::Bin
+ class << self
+
+ def class_for(key)
+ case key
+ when :cdn
+ Fog::HP::CDN
+ when :compute
+ Fog::HP::Compute
+ when :storage
+ Fog::HP::Storage
+ else
+ raise ArgumentError, "Unrecognized service: #{key}"
+ end
+ end
+
+ def [](service)
+ @@connections ||= Hash.new do |hash, key|
+ hash[key] = case key
+ when :cdn
+ Fog::CDN.new(:provider => 'HP')
+ when :compute
+ Fog::Compute.new(:provider => 'HP')
+ when :dns
+ Fog::DNS.new(:provider => 'HP')
+ when :storage
+ Fog::Storage.new(:provider => 'HP')
+ else
+ raise ArgumentError, "Unrecognized service: #{key.inspect}"
+ end
+ end
+ @@connections[service]
+ end
+
+ def services
+ Fog::HP.services
+ end
+
+ end
+end
|
Add a HP provider class for the fog binary.
|
diff --git a/lib/tasks/full_import.rake b/lib/tasks/full_import.rake
index abc1234..def5678 100644
--- a/lib/tasks/full_import.rake
+++ b/lib/tasks/full_import.rake
@@ -25,6 +25,7 @@ client.download_xml_files
client.populate_studies
+ load_event.update(new_studies: Study.count, changed_studies: 0)
load_event.complete
SanityCheck.run
|
Add full import load event study count.
|
diff --git a/lib/tasks/maintenance.rake b/lib/tasks/maintenance.rake
index abc1234..def5678 100644
--- a/lib/tasks/maintenance.rake
+++ b/lib/tasks/maintenance.rake
@@ -16,6 +16,9 @@ begin
m.attachment_height = Paperclip::Geometry.from_file(m.attachment.path(:big)).height.to_i
m.save(false)
+ puts "#----------------------------------------------------------------------------"
+ puts "#{m.attachment_height} px: #{m.attachment.path(:big)}"
+ puts "#----------------------------------------------------------------------------"
rescue
RAILS_DEFAULT_LOGGER.error "[ Maintenance ] There is a problem with the attachment #{m.id}"
end
|
Add debug puts in rake task
|
diff --git a/app/controllers/profile_photos_controller.rb b/app/controllers/profile_photos_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/profile_photos_controller.rb
+++ b/app/controllers/profile_photos_controller.rb
@@ -1,7 +1,7 @@ class ProfilePhotosController < ApplicationController
def create
photo = ProfilePhoto.create(profile_photo_params)
- render json: photo
+ render text: photo.to_json
end
private
|
Return photo JSON with text MIME type
This is a work around for an IE issue. Recent versions of IE treat the
photo JSON returned as a file download, instead of passing it to the
target iframe.
Tested in IE11 against staging environment.
|
diff --git a/qu.gemspec b/qu.gemspec
index abc1234..def5678 100644
--- a/qu.gemspec
+++ b/qu.gemspec
@@ -2,7 +2,9 @@ $:.push File.expand_path("../lib", __FILE__)
require "qu/version"
-plugins = Dir['qu-*.gemspec'].map {|gemspec| gemspec.scan(/qu-(.*)\.gemspec/).flatten.first }.join('\|')
+plugin_files = Dir['qu-*.gemspec'].map { |gemspec|
+ eval(File.read(gemspec)).files
+}.flatten.uniq
Gem::Specification.new do |s|
s.name = "qu"
@@ -13,8 +15,8 @@ s.summary = %q{}
s.description = %q{}
- s.files = `git ls-files | grep -v '#{plugins}'`.split("\n")
- s.test_files = `git ls-files -- spec | grep -v '#{plugins}'`.split("\n")
+ s.files = `git ls-files`.split("\n") - plugin_files
+ s.test_files = `git ls-files -- spec`.split("\n")
s.executables = `git ls-files -- bin`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]
|
Read plugin gemspecs to get list of plugin files.
|
diff --git a/spec/controllers/static_pages_controller_spec.rb b/spec/controllers/static_pages_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/static_pages_controller_spec.rb
+++ b/spec/controllers/static_pages_controller_spec.rb
@@ -8,12 +8,5 @@ expect(response).to have_http_status(:success)
end
end
-
- describe 'GET #map' do
- it 'returns http success' do
- get :map
- expect(response).to have_http_status(:success)
- end
- end
end
|
Remove test for old static map
|
diff --git a/app/workers/share_analytics_updater.rb b/app/workers/share_analytics_updater.rb
index abc1234..def5678 100644
--- a/app/workers/share_analytics_updater.rb
+++ b/app/workers/share_analytics_updater.rb
@@ -3,21 +3,44 @@
class ShareAnalyticsUpdater
def self.update_shares
- puts "Fetching data..."
+ new(nil).update_collection
+ end
- uri = 'http://run.shareprogress.org/api/v1/buttons/analytics'
- uri = URI.parse(uri)
+ def initialize(collection)
+ #Collection can be passed explicitly in order to reuse this task to update only a section of buttons at a later time.
+ @collection = collection || Share::Button.all
+ @uri = URI.parse('http://run.shareprogress.org/api/v1/buttons/analytics')
+ @sp_api_key = ENV['SHARE_PROGRESS_API_KEY']
+ end
- Share::Button.all.each do |button|
- response = Net::HTTP.post_form(uri, {key: ENV['SHARE_PROGRESS_API_KEY'], id: button.sp_id})
- parsed_body = JSON.parse(response.body).with_indifferent_access
- if parsed_body[:success]
- button.update!(analytics: response.body )
- else
- raise "ShareProgress button update failed with the following message from their API: #{parsed_body[:message]}."
+ def update_collection
+ update_shares
+ end
+
+ private
+
+ def update_shares
+ @collection.each do |button|
+ begin
+ request_analytics_from_sp(button)
+ rescue ::ShareProgressApiError
+ puts $!.message
+ next
end
end
+ end
- puts "Fetching has completed."
+ def request_analytics_from_sp(button)
+ response = Net::HTTP.post_form(@uri, {key: @sp_api_key, id: button.sp_id})
+ raise_or_update(response, button)
+ end
+
+ def raise_or_update(response, button)
+ parsed_body = JSON.parse(response.body).with_indifferent_access
+ if parsed_body[:success]
+ button.update!(analytics: response.body )
+ else
+ raise ::ShareProgressApiError, "ShareProgress button analytics update failed with the following message from their API: #{parsed_body[:message]}."
+ end
end
end
|
Tidy up share analytics updater class
|
diff --git a/spec/views/duckrails/home/index.html.erb_spec.rb b/spec/views/duckrails/home/index.html.erb_spec.rb
index abc1234..def5678 100644
--- a/spec/views/duckrails/home/index.html.erb_spec.rb
+++ b/spec/views/duckrails/home/index.html.erb_spec.rb
@@ -1,5 +1,20 @@ require 'rails_helper'
-RSpec.describe "home/index.html.erb", type: :view do
- pending "add some examples to (or delete) #{__FILE__}"
+RSpec.describe 'duckrails/home/index.html.erb', type: :view do
+ let(:title) { t('Home') }
+
+ before do
+ render
+ end
+
+ subject { rendered }
+
+ context 'content' do
+ it { should have_css ".welcome img[src='#{view.asset_path('duckrails.png')}']" }
+ it { should have_css '.welcome .home-welcome h1', text: t(:mock_the_universe) }
+ it { should have_css '.welcome .home-welcome .page-guide', text: t(:welcome_message) }
+
+ it { should have_css "a.button[href='#{view.duckrails_mocks_path}']", text: t(:view_all_mocks) }
+ it { should have_css "a.button[href='#{view.new_duckrails_mock_path}']", text: t(:create_new_mock) }
+ end
end
|
Add view specs for application’s index.
|
diff --git a/app/controllers/api/logs_controller.rb b/app/controllers/api/logs_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/api/logs_controller.rb
+++ b/app/controllers/api/logs_controller.rb
@@ -16,7 +16,12 @@ log[:event] = params[:event]
log[:time] = DateTime.strptime("#{params[:time].to_i/1000}",'%s').in_time_zone("Eastern Time (US & Canada)").to_s
log[:parameters] = params[:parameters]
- log[:extras] = params[:extras]
+ log[:extras] = Hash.new
+ request.request_parameters.each do |key,value|
+ if key != "log" && key != "session" && key != "user" && key != "application" && key != "activity" && key != "event" && key != "time" && key != "parameters"
+ log[:extras][key] = value
+ end
+ end
if log.save
render json: log, status: :created
|
Store extra key:value pairs from json post in extras
|
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
@@ -1,7 +1,7 @@ class CommentsController < ApplicationController
- before_action :set_submission
def create
+ @submission = Submission.find(params[:submission_id])
@comment = @submission.comments.build({ body: comment_params[:body], submission: @submission, user: current_user })
if @comment.save
@@ -12,10 +12,6 @@ end
private
- def set_submission
- @submission = Submission.find(params[:submission_id])
- end
-
def comment_params
params.require(:comment).permit(:body)
end
|
Refactor comments controller, remove set_submission method
|
diff --git a/app/controllers/services_controller.rb b/app/controllers/services_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/services_controller.rb
+++ b/app/controllers/services_controller.rb
@@ -1,6 +1,6 @@ class ServicesController < ApplicationController
def index
@authority = LocalAuthority.find_by_slug!(params[:local_authority_slug])
- @services = @authority.provided_services
+ @services = @authority.provided_services.order(lgsl_code: :asc)
end
end
|
Order Services by LGSL code
The services are now ordered by LGSL until we decide there is a better
way to order them.
|
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
@@ -3,13 +3,15 @@
def create
session[:user_id] = user.id
- redirect_to session[:return_url] || root_path
+ redirect_to return_path
end
def destroy
session[:user_id] = nil
- redirect_to root_url, :notice => "Signed out"
+ redirect_to return_path
end
+
+ private
def auth
request.env["omniauth.auth"]
@@ -22,4 +24,8 @@ def existing_user
@user ||= User.where(provider: auth["provider"], uid: auth["uid"]).first
end
+
+ def return_path
+ session[:return_url] || root_path
+ end
end
|
Return users to the correct page on sign out
|
diff --git a/app/controllers/versions_controller.rb b/app/controllers/versions_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/versions_controller.rb
+++ b/app/controllers/versions_controller.rb
@@ -9,7 +9,7 @@ if @version
@instrument_version = @version.reify
else
- redirect_to @instrument
+ redirect_to project_instrument_path(current_project, @instrument)
end
end
end
|
Send to current project instruments path for current instrument version
|
diff --git a/test/helper.rb b/test/helper.rb
index abc1234..def5678 100644
--- a/test/helper.rb
+++ b/test/helper.rb
@@ -1,4 +1,5 @@ require 'rubygems'
+gem 'test-unit', '>= 2.1'
require 'test/unit'
require 'shoulda'
|
Add gem version dependency on test-unit >= 2.1.0
|
diff --git a/test/integration/add-ons-no-fqdn/default_spec.rb b/test/integration/add-ons-no-fqdn/default_spec.rb
index abc1234..def5678 100644
--- a/test/integration/add-ons-no-fqdn/default_spec.rb
+++ b/test/integration/add-ons-no-fqdn/default_spec.rb
@@ -10,8 +10,4 @@ describe command('chef-manage-ctl status') do
its(:exit_status) { should eq 0 }
end
-
- describe command('sudo chef-sync-ctl sync-status') do
- its(:exit_status) { should eq 0 }
- end
end
|
Remove the test from the old sync install
Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
|
diff --git a/cowserv.rb b/cowserv.rb
index abc1234..def5678 100644
--- a/cowserv.rb
+++ b/cowserv.rb
@@ -1,8 +1,10 @@ #!/usr/bin/env ruby
+
+require "erb"
+require "open3"
require "rubygems"
require "sinatra"
-require "erb"
COWSAY_OPTIONS = %w(f b d g p s t w y e T W)
@@ -19,29 +21,34 @@ end
get "/list" do
- `cowsay -l`.split("\n")[1..-1].join(" ").split(/\s+/).join("\n")
+ read("cowsay -l").split("\n")[1..-1].join(" ").split(/\s+/).join("\n")
end
helpers do
+ def link(path)
+ url = "http://#{request.host}#{request.port != 80 ? ":" + request.port.to_s : ""}/#{path}"
+ "<a href=\"#{url}\">#{url}</a>"
+ end
+
def extract_cowsay_options(params)
params.find_all { |key, val| COWSAY_OPTIONS.include?(key) }
end
-
+
def escape(text)
text.gsub("`", "\\`")
end
-
+
+ def read(command)
+ Open3.popen3(command)[1].read
+ end
+
def cowsay(message, options = [])
command = "cowsay "
command << options.collect do |key, val|
"-#{key}" + (val.nil? ? "" : " \"#{escape(val)}\"")
end.join(" ") + " "
command << "\"#{escape(message)}\""
- `#{command}`
- end
-
- def link(path)
- url = "http://#{request.host}#{request.port != 80 ? ":" + request.port.to_s : ""}/#{path}"
- "<a href=\"#{url}\">#{url}</a>"
+
+ read(command)
end
end
|
Use Open3 to execute cowsay instead of dangerous backticks
|
diff --git a/app/models/document_series.rb b/app/models/document_series.rb
index abc1234..def5678 100644
--- a/app/models/document_series.rb
+++ b/app/models/document_series.rb
@@ -4,7 +4,9 @@
belongs_to :organisation
- has_many :groups, class_name: 'DocumentSeriesGroup', order: 'document_series_groups.ordering'
+ has_many :groups, class_name: 'DocumentSeriesGroup',
+ order: 'document_series_groups.ordering',
+ dependent: :destroy
has_many :documents, through: :groups
has_many :editions, through: :documents
|
Destroy doc series groups when series deleted
|
diff --git a/tasks/vendor_sqlite3.rake b/tasks/vendor_sqlite3.rake
index abc1234..def5678 100644
--- a/tasks/vendor_sqlite3.rake
+++ b/tasks/vendor_sqlite3.rake
@@ -17,7 +17,7 @@
unless File.exist?(checkpoint)
cflags = "-O2 -DSQLITE_ENABLE_COLUMN_METADATA"
- cflags << " -fPIC" if recipe.host.include?("x86_64")
+ cflags << " -fPIC" if recipe.host && recipe.host.include?("x86_64")
recipe.configure_options << "CFLAGS='#{cflags}'"
recipe.cook
touch checkpoint
|
Fix mini ports compilation issue
Host might not be set when doing native compilation.
|
diff --git a/lib/chef/provider/log.rb b/lib/chef/provider/log.rb
index abc1234..def5678 100644
--- a/lib/chef/provider/log.rb
+++ b/lib/chef/provider/log.rb
@@ -24,6 +24,8 @@ # @author Cary Penniman <cary@rightscale.com>
# @author Tyler Cloke <tyler@chef.io>
class ChefLog < Chef::Provider
+ provides :log
+
# No concept of a 'current' resource for logs, this is a no-op
#
# @return [true] Always returns true
|
Add back the provides to the provider
Magic doesn't work here since the class name isn't magical
Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
|
diff --git a/lib/dbt/drivers/mssql.rb b/lib/dbt/drivers/mssql.rb
index abc1234..def5678 100644
--- a/lib/dbt/drivers/mssql.rb
+++ b/lib/dbt/drivers/mssql.rb
@@ -17,7 +17,7 @@ include Dbt::SqlServerConfig
def self.jdbc_driver_dependencies
- %w(net.sourceforge.jtds:jtds:jar:1.2.4)
+ %w(net.sourceforge.jtds:jtds:jar:1.2.7)
end
def jdbc_driver
|
Upgrade to a more modern version of jtds
|
diff --git a/omniauth-eventbrite.gemspec b/omniauth-eventbrite.gemspec
index abc1234..def5678 100644
--- a/omniauth-eventbrite.gemspec
+++ b/omniauth-eventbrite.gemspec
@@ -14,7 +14,6 @@
spec.files = `git ls-files`.split("\n")
spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
- spec.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
spec.require_paths = ['lib']
spec.add_dependency 'omniauth-oauth2', '~> 1.0'
|
Remove non-existent executables from spec
|
diff --git a/lib/heroku/kensa/http.rb b/lib/heroku/kensa/http.rb
index abc1234..def5678 100644
--- a/lib/heroku/kensa/http.rb
+++ b/lib/heroku/kensa/http.rb
@@ -27,12 +27,13 @@
begin
args = [
- (OkJson.encode(payload) if payload),
- {
- :accept => "application/json",
- :content_type => "application/json"
- }
- ].compact
+ { :accept => "application/json" }
+ ]
+
+ if payload
+ args.first[:content_type] = "application/json"
+ args.unshift OkJson.encode(payload)
+ end
user, pass = credentials
body = RestClient::Resource.new(url, user, pass)[path].send(
|
Use JSON content-type only if payload exists
|
diff --git a/lib/mnemosyne/builder.rb b/lib/mnemosyne/builder.rb
index abc1234..def5678 100644
--- a/lib/mnemosyne/builder.rb
+++ b/lib/mnemosyne/builder.rb
@@ -11,7 +11,22 @@ # rubocop:disable Metrics/AbcSize
# rubocop:disable Metrics/MethodLength
def create!
+ activity = ::Activity.fetch payload.fetch(:transaction)
+ application = ::Application.fetch payload.fetch(:application)
+
ActiveRecord::Base.transaction do
+ trace ||= begin
+ ::Trace.create! \
+ id: payload[:uuid],
+ origin_id: payload[:origin],
+ application: application,
+ activity: activity,
+ name: payload[:name],
+ start: Integer(payload[:start]),
+ stop: Integer(payload[:stop]),
+ meta: payload[:meta]
+ end
+
Array(payload[:span]).each do |span|
::Span.create! \
id: span[:uuid],
@@ -24,28 +39,6 @@ end
end
- def application
- @application ||= ::Application.fetch payload.fetch(:application)
- end
-
- def activity
- @activity ||= ::Activity.fetch payload.fetch(:transaction)
- end
-
- def trace
- @trace ||= begin
- ::Trace.create! \
- id: payload[:uuid],
- origin_id: payload[:origin],
- application: application,
- activity: activity,
- name: payload[:name],
- start: Integer(payload[:start]),
- stop: Integer(payload[:stop]),
- meta: payload[:meta]
- end
- end
-
class << self
def create!(payload)
new(payload).create!
|
Move Activity and Application fetchout of transaction
This should reduce not unique record exceptions due to creating unique
activities in longer transactions.
|
diff --git a/lib/pager_api/railtie.rb b/lib/pager_api/railtie.rb
index abc1234..def5678 100644
--- a/lib/pager_api/railtie.rb
+++ b/lib/pager_api/railtie.rb
@@ -1,8 +1,7 @@ module PagerApi
class Railtie < Rails::Railtie
- config.after_initialize do
+ initializer "pager_api.configure_pagination_helpers" do
require 'pager_api/hooks'
end
end
end
-
|
Fix loading pagination helpers for rails 5
|
diff --git a/lib/serverkit/command.rb b/lib/serverkit/command.rb
index abc1234..def5678 100644
--- a/lib/serverkit/command.rb
+++ b/lib/serverkit/command.rb
@@ -26,7 +26,7 @@ when "validate"
validate
else
- raise Errors::UnknownActionNameError
+ raise Errors::UnknownActionNameError, action_name
end
rescue Errors::Base, Slop::MissingArgumentError, Slop::MissingOptionError => exception
abort "Error: #{exception}"
|
Fix unknown action name handling
|
diff --git a/lib/similarweb/client.rb b/lib/similarweb/client.rb
index abc1234..def5678 100644
--- a/lib/similarweb/client.rb
+++ b/lib/similarweb/client.rb
@@ -31,7 +31,10 @@ protected
def request(uri, params = {}, http_method = :get)
- response = http_client.public_send(http_method, "#{uri}?Format=JSON&UserKey=#{api_key}")
+ parse_response(http_client.public_send(http_method, "#{uri}?Format=JSON&UserKey=#{api_key}"))
+ end
+
+ def parse_response(response)
JSON(response.body)
end
|
Refactor to add a parse response method
|
diff --git a/lib/tasks/start_app.rake b/lib/tasks/start_app.rake
index abc1234..def5678 100644
--- a/lib/tasks/start_app.rake
+++ b/lib/tasks/start_app.rake
@@ -0,0 +1,10 @@+require 'test_app_starter.rb'
+
+namespace :idt do # idt stands for Image Downloader Test
+ desc 'Start test sinatra application'
+ task :start_app do
+ app = TestAppStarter.new(4567)
+ app.start
+ app.wait
+ end
+end
|
Add rake task to start test app
|
diff --git a/lib/vcloud/net_launch.rb b/lib/vcloud/net_launch.rb
index abc1234..def5678 100644
--- a/lib/vcloud/net_launch.rb
+++ b/lib/vcloud/net_launch.rb
@@ -5,7 +5,7 @@ class NetLaunch
def initialize
- @config_loader = Vcloud::ConfigLoader.new
+ @config_loader = Vcloud::Core::ConfigLoader.new
end
def run(config_file = nil, options = {})
|
Update Net Launch to use core config
I meant to do this and forgot, and this was only picked up in the long version of the integration tests. Meaning that there are no unit tests around this at all. We should fix that.
|
diff --git a/sequel/benchmarks/bm_sequel_discourse.rb b/sequel/benchmarks/bm_sequel_discourse.rb
index abc1234..def5678 100644
--- a/sequel/benchmarks/bm_sequel_discourse.rb
+++ b/sequel/benchmarks/bm_sequel_discourse.rb
@@ -0,0 +1,79 @@+require "bundler/setup"
+require "sequel"
+
+require_relative "support/benchmark_sequel"
+
+db_setup script: "bm_discourse_setup.rb"
+
+DB = Sequel.connect(ENV.fetch("DATABASE_URL"))
+
+class User < Sequel::Model
+ one_to_many :topic_users
+ one_to_many :category_users
+ one_to_many :topics
+end
+
+class Topic < Sequel::Model
+ one_to_many :topic_users
+ one_to_many :categories
+ many_to_one :user
+ many_to_one :category
+
+ dataset_module do
+ def listable_topics
+ where(Sequel.lit("topics.archetype <> ?", "private_message"))
+ end
+ end
+end
+
+class TopicUser < Sequel::Model
+ many_to_one :topic
+ many_to_one :user
+end
+
+class Category < Sequel::Model
+ one_to_many :category_users
+ one_to_many :topics
+ many_to_one :topic
+end
+
+class CategoryUser < Sequel::Model
+ many_to_one :category
+ many_to_one :user
+end
+
+user = User.first
+
+Benchmark.sequel("sequel/#{db_adapter}_discourse", time: 5) do
+ str = ""
+ Topic
+ .unfiltered
+ .eager_graph(Sequel.as(:category, :categories))
+ .eager_graph(Sequel.as(:user, :users))
+ .left_outer_join(Sequel.lit("topic_users AS tu ON (topics.id = tu.topic_id AND tu.user_id = #{user.id})"))
+ .listable_topics
+ .where(Sequel.lit("COALESCE(categories.topic_id, 0) <> topics.id"))
+ .where(Sequel.lit("topics.deleted_at IS NULL"))
+ .where(Sequel.lit(
+ "NOT EXISTS (
+ SELECT 1 FROM category_users cu
+ WHERE cu.user_id = :user_id
+ AND cu.category_id = topics.category_id
+ AND cu.notification_level = :muted
+ AND cu.category_id <> :category_id
+ AND (tu.notification_level IS NULL OR tu.notification_level < :tracking)
+ )",
+ user_id: user.id, muted: 0, tracking: 2, category_id: -1)
+ ).where(
+ Sequel.lit(
+ "pinned_globally AND
+ pinned_at IS NOT NULL AND
+ (topics.pinned_at > tu.cleared_pinned_at OR tu.cleared_pinned_at IS NULL)"
+ )
+ ).order(Sequel.lit("topics.bumped_at DESC"))
+ .limit(30)
+ .all
+ .each do |topic|
+ str << "id: #{topic.id} title: #{topic.title} created_at: #{topic.created_at} user: #{topic.user.username}\n"
+ end
+end
|
Add sequel real world discourse bench
|
diff --git a/MBAlertView.podspec b/MBAlertView.podspec
index abc1234..def5678 100644
--- a/MBAlertView.podspec
+++ b/MBAlertView.podspec
@@ -1,6 +1,6 @@ Pod::Spec.new do |s|
s.name = "MBAlertView"
- s.version = "1.2.0"
+ s.version = "1.3.0"
s.summary = "Fast, fun, and simple block-based alerts and HUDs."
s.description = <<-DESC
MBAlertView is a fun and simple block-based alert and HUD library for iOS, as seen in Notestand.
@@ -9,9 +9,8 @@ s.license = 'MIT'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { "Mo Bitar" => "me@mbbitar.com" }
- s.source = { :git => "https://github.com/cabbiepete/MBAlertView.git", :tag => "1.2.0" }
+ s.source = { :git => "https://github.com/cabbiepete/MBAlertView.git", :tag => "1.3.0" }
s.platform = :ios
- s.dependency 'AutoLayoutHelpers', '~> 1.0.0'
s.source_files = 'MBAlertView/**/*.{h,m}'
|
Update pod spec to new tag
Pulled from upstream.
|
diff --git a/test_lib/broker_config.rb b/test_lib/broker_config.rb
index abc1234..def5678 100644
--- a/test_lib/broker_config.rb
+++ b/test_lib/broker_config.rb
@@ -7,7 +7,8 @@ when 'bunny'
{
adapter: :bunny,
- vhost: 'message-driver-test'
+ vhost: 'message-driver-test',
+ continuation_timeout: 10000
}
when 'in_memory'
{adapter: :in_memory}
|
Increase bunny continuation_timeout since ci is slow
|
diff --git a/distribution/homebrew/mhost.rb b/distribution/homebrew/mhost.rb
index abc1234..def5678 100644
--- a/distribution/homebrew/mhost.rb
+++ b/distribution/homebrew/mhost.rb
@@ -1,8 +1,8 @@ class Mhost < Formula
desc "More than host - A modern take on the classic host DNS lookup utility"
homepage "https://mhost.pustina.de"
- url "https://github.com/lukaspustina/mhost/archive/v0.3.0-alpha.2.tar.gz"
- sha256 "9634dc460d1857b2a845e10e7ff7a16d54b77ddb312fcc5fda6d59d5660f2780"
+ url "https://github.com/lukaspustina/mhost/archive/v0.3.0.tar.gz"
+ sha256 "651a8abd334325b3d743e7ff930027e1ffad2ff15885b81bbf65b03284f2091c"
license any_of: ["MIT", "Apache-2.0"]
head "https://github.com/lukaspustina/mhost.git"
|
Update homebrew formula for release 0.3.0
|
diff --git a/spec/features/course/lesson_plan_spec.rb b/spec/features/course/lesson_plan_spec.rb
index abc1234..def5678 100644
--- a/spec/features/course/lesson_plan_spec.rb
+++ b/spec/features/course/lesson_plan_spec.rb
@@ -0,0 +1,51 @@+require 'rails_helper'
+
+RSpec.feature 'Course: Lesson Plan' do
+ subject { page }
+ let!(:instance) { create(:instance) }
+
+ with_tenant(:instance) do
+ let!(:user) { create(:administrator) }
+ let!(:course) { create(:course) }
+ let(:milestone_title_prefix) { 'Spec milestone ' }
+ let(:event_title_prefix) { 'Spec event ' }
+
+ let!(:milestones) do
+ [2.days.ago, 2.days.from_now].map do |start_time|
+ create(:course_lesson_plan_milestone,
+ course: course,
+ start_time: start_time,
+ title: milestone_title_prefix + start_time.to_s)
+ end
+ end
+
+ let!(:events) do
+ past_dates = (1..3).map { |i| i.days.ago }
+ future_dates = (0..3).map { |i| i.days.from_now }
+
+ (past_dates + future_dates).map do |start_time|
+ create(:course_event,
+ course: course,
+ start_time: start_time,
+ title: event_title_prefix + start_time.to_s)
+ end
+ end
+
+ context 'As a Course Administrator' do
+ before do
+ login_as(user, scope: :user)
+ end
+
+ scenario 'I can view all lesson plan items grouped by milestone' do
+ visit course_lesson_plan_path(course)
+ milestones.each do |m|
+ expect(subject).to have_text(m.title)
+ end
+
+ events.each do |item|
+ expect(subject).to have_text(item.title)
+ end
+ end
+ end
+ end
+end
|
Add Course Lesson Plan feature specs
|
diff --git a/spec/functional/web_link_row_spec.rb b/spec/functional/web_link_row_spec.rb
index abc1234..def5678 100644
--- a/spec/functional/web_link_row_spec.rb
+++ b/spec/functional/web_link_row_spec.rb
@@ -0,0 +1,35 @@+describe "FormController/WebLinkRow" do
+ tests Formotion::FormController
+
+ # By default, `tests` uses @controller.init
+ # this isn't ideal for our case, so override.
+ def controller
+ row_settings = {
+ title: "WebLink",
+ key: :web_link,
+ type: :web_link,
+ value: "http://www.rubymotion.com"
+ }
+ @form ||= Formotion::Form.new(
+ sections: [{
+ rows:[row_settings]
+ }])
+
+ @controller ||= Formotion::FormController.alloc.initWithForm(@form)
+ end
+
+ def weblink_row
+ @form.row(:web_link)
+ end
+
+ it "should accept a string" do
+ weblink_row.value.should == "http://www.rubymotion.com"
+ end
+
+ it "should accept a NSURL" do
+ weblink_row.value = NSURL.URLWithString("http://www.rubymotion.com")
+ weblink_row.value.is_a?(NSURL).should == true
+ weblink_row.value.absoluteString.should == "http://www.rubymotion.com"
+ end
+
+end
|
Add functional test for WebLinkRow
|
diff --git a/db/migrate/20190221194939_change_admin_partner_id_to_bigint.rb b/db/migrate/20190221194939_change_admin_partner_id_to_bigint.rb
index abc1234..def5678 100644
--- a/db/migrate/20190221194939_change_admin_partner_id_to_bigint.rb
+++ b/db/migrate/20190221194939_change_admin_partner_id_to_bigint.rb
@@ -0,0 +1,9 @@+class ChangeAdminPartnerIdToBigint < ActiveRecord::Migration[6.0]
+ def up
+ change_column :admin_partners, :id, :bigint
+ end
+
+ def down
+ change_column :admin_partners, :id, :integer
+ end
+end
|
Update admin_partner_id primary key to bigint
|
diff --git a/users.gemspec b/users.gemspec
index abc1234..def5678 100644
--- a/users.gemspec
+++ b/users.gemspec
@@ -18,7 +18,6 @@ spec.require_paths = ["lib"]
spec.add_dependency 'bound'
- spec.add_dependency 'bcrypt'
spec.add_development_dependency "bundler", "~> 1.7"
spec.add_development_dependency "rake", "~> 10.0"
|
Revert "Add bcrypt and bundle"
This reverts commit 2d33b11fb46e360afe8f7c350a19e181d0531827.
|
diff --git a/valor.gemspec b/valor.gemspec
index abc1234..def5678 100644
--- a/valor.gemspec
+++ b/valor.gemspec
@@ -20,4 +20,6 @@
spec.add_development_dependency "bundler", "~> 1.5"
spec.add_development_dependency "rake"
+
+ spec.add_runtime_dependency 'json'
end
|
Add json to runtime dependency list
|
diff --git a/mp4-h264-nginx-module.rb b/mp4-h264-nginx-module.rb
index abc1234..def5678 100644
--- a/mp4-h264-nginx-module.rb
+++ b/mp4-h264-nginx-module.rb
@@ -14,16 +14,18 @@ end
__END__
---- ../nginx_mod_h264_streaming-2.2.7/src/ngx_http_streaming_module.c.orig 2010-05-24 18:04:43.000000000 +0400
-+++ ../nginx_mod_h264_streaming-2.2.7/src/ngx_http_streaming_module.c 2010-05-24 18:05:02.000000000 +0400
-@@ -155,10 +155,6 @@
+diff --git a/src/ngx_http_streaming_module.c b/src/ngx_http_streaming_module.c
+index 8d565c9..a8df30e 100644
+--- a/src/ngx_http_streaming_module.c
++++ b/src/ngx_http_streaming_module.c
+@@ -155,10 +155,6 @@ static ngx_int_t ngx_streaming_handler(ngx_http_request_t *r)
}
-
+
/* TODO: Win32 */
- if (r->zero_in_uri)
- {
- return NGX_DECLINED;
- }
-
+
rc = ngx_http_discard_request_body(r);
-
+
|
Fix patch __END__ data for mp4-h264 module
Homebrew/homebrew-nginx#68
|
diff --git a/core/lib/refinery/catch_all_routes.rb b/core/lib/refinery/catch_all_routes.rb
index abc1234..def5678 100644
--- a/core/lib/refinery/catch_all_routes.rb
+++ b/core/lib/refinery/catch_all_routes.rb
@@ -1,11 +1,3 @@ ::Refinery::Application.routes.draw do
- match '/admin(/*path)', :to => redirect {|params, request|
- request.flash[:message] = "<p>
- The URL '/<strong>admin</strong>#{"/#{params[:path]}" unless params[:path].blank?}' will be removed in Refinery CMS version 1.0
- <br/>
- Please use '/<strong>refinery</strong>#{"/#{params[:path]}" unless params[:path].blank?}' instead.
- </p>".html_safe
- "/refinery#{"/#{params[:path]}" unless params[:path].blank?}"
- }
match '/refinery/*path' => 'admin/base#error_404'
end
|
Remove /admin catch all route.
|
diff --git a/test/features/loged_user_can_only_manages_its_owm_organization_services_test.rb b/test/features/loged_user_can_only_manages_its_owm_organization_services_test.rb
index abc1234..def5678 100644
--- a/test/features/loged_user_can_only_manages_its_owm_organization_services_test.rb
+++ b/test/features/loged_user_can_only_manages_its_owm_organization_services_test.rb
@@ -0,0 +1,42 @@+require "test_helper"
+
+class LogedUserCanOnlyManagesItsOwmOrganizationServicesTest < Capybara::Rails::TestCase
+ include Warden::Test::Helpers
+ after { Warden.test_reset! }
+
+ test "non gobierno digital user can view services" do
+ login_as users(:pedro), scope: :user
+ service_version = service_versions(:servicio1_v1)
+ visit organization_service_service_version_path(service_version.organization, service_version.service, service_version)
+ find('#user-menu').click
+ assert_content page, users(:pedro).name
+ assert_content page, users(:pedro).organizations.take.name
+ assert_content page, "servicio_1 R1"
+ refute_content page, "Nueva Revisión"
+ refute_content page, "Nuevo Servicio"
+ end
+
+ test "user can't upload new service to other organization" do
+ login_as users(:pedro), scope: :user
+ org = organizations(:segpres)
+ visit new_organization_service_path(org)
+ find('#user-menu').click
+ assert_content page, users(:pedro).name
+ assert_content page, users(:pedro).organizations.take.name
+ assert_content page,"No tiene permisos suficientes"
+ refute_content page, "Nueva Revisión"
+ refute_content page, "Nuevo Servicio"
+ end
+
+ test "user can't create new services version to other organization" do
+ login_as users(:pedro), scope: :user
+ service = services(:servicio_1)
+ visit new_organization_service_path(service.organization, service)
+ find('#user-menu').click
+ assert_content page, users(:pedro).name
+ assert_content page, users(:pedro).organizations.take.name
+ assert_content page,"No tiene permisos suficientes"
+ refute_content page, "Nueva Revisión"
+ refute_content page, "Nuevo Servicio"
+ end
+end
|
Add test for user can't mannage services,
or versions for other organizations.
|
diff --git a/lib/active_record/associations/builder/count_loader.rb b/lib/active_record/associations/builder/count_loader.rb
index abc1234..def5678 100644
--- a/lib/active_record/associations/builder/count_loader.rb
+++ b/lib/active_record/associations/builder/count_loader.rb
@@ -1,6 +1,8 @@ module ActiveRecord::Associations::Builder
class CountLoader < SingularAssociation
- self.valid_options = [:class_name, :foreign_key]
+ def valid_options
+ super + [:primary_key, :dependent, :as, :through, :source, :source_type, :inverse_of, :counter_cache, :join_table, :foreign_type]
+ end
def macro
:count_loader
|
Support all of has_many options
|
diff --git a/core/spec/interactors/queries/feed_global.rb b/core/spec/interactors/queries/feed_global.rb
index abc1234..def5678 100644
--- a/core/spec/interactors/queries/feed_global.rb
+++ b/core/spec/interactors/queries/feed_global.rb
@@ -0,0 +1,32 @@+require 'spec_helper'
+
+describe Interactors::Feed::Global do
+ include PavlovSupport
+
+ describe '#call' do
+ it 'filters out invalid activities' do
+ user = create :user
+ fact = create :fact
+ as(user) do |pavlov|
+
+ comment1 = pavlov.interactor :'comments/create', fact_id: fact.id.to_i, content: 'hallo1'
+ sleep 0.001
+ comment2 = pavlov.interactor :'comments/create', fact_id: fact.id.to_i, content: 'hallo2'
+ sleep 0.001
+ comment3 = pavlov.interactor :'comments/create', fact_id: fact.id.to_i, content: 'hallo3'
+
+ feed_before_delete = pavlov.interactor :'feed/global', count: '2'
+ p feed_before_delete.map{|c|c[:comment].formatted_content}
+ expect(feed_before_delete.size).to eq 2
+ expect(feed_before_delete[1][:comment].formatted_content).to eq 'hallo2'
+
+ pavlov.interactor :'comments/delete', comment_id: comment2.id.to_s
+
+ feed_after_delete = pavlov.interactor :'feed/global', count: '2'
+ p feed_after_delete.map{|c|c[:comment].formatted_content}
+ expect(feed_after_delete.size).to eq 2
+ expect(feed_after_delete[1][:comment].formatted_content).to eq 'hallo1'
+ end
+ end
+ end
+end
|
Add unit test verifying that activities are now lazily fetched as needed
|
diff --git a/spec/models/person_spec.rb b/spec/models/person_spec.rb
index abc1234..def5678 100644
--- a/spec/models/person_spec.rb
+++ b/spec/models/person_spec.rb
@@ -22,7 +22,7 @@ end
it 'stores arbitrary fields' do
- fields = { 'a field' => 'b', 'd' => 3, 'f' => true }
+ fields = { 'a field!@#$%^&*()[]{}_-="\'' => 'b💩', 'd💩' => 3, 'f' => true }
person = build(:person, fields: fields)
expect(person.save).to be true
person.reload
|
Test that arbitrary fields can hold non-ascii characters.
|
diff --git a/db/migrate/8_add_timestamps_to_all_tables.rb b/db/migrate/8_add_timestamps_to_all_tables.rb
index abc1234..def5678 100644
--- a/db/migrate/8_add_timestamps_to_all_tables.rb
+++ b/db/migrate/8_add_timestamps_to_all_tables.rb
@@ -0,0 +1,12 @@+class AddTimestampsToAllTables < ActiveRecord::Migration
+ def change
+ [
+ :usda_food_groups, :usda_foods, :usda_foods_nutrients,
+ :usda_weights, :usda_footnotes, :usda_source_codes,
+ :usda_nutrients
+ ].each do |table_name|
+ add_column table_name, :created_at, :datetime
+ add_column table_name, :updated_at, :datetime
+ end
+ end
+end
|
Add timestamps to all tables
|
diff --git a/Casks/appcleaner.rb b/Casks/appcleaner.rb
index abc1234..def5678 100644
--- a/Casks/appcleaner.rb
+++ b/Casks/appcleaner.rb
@@ -1,13 +1,13 @@ cask :v1 => 'appcleaner' do
- version '2.2.3'
- sha256 '90b3d8e3c32388035e5154594222d66d48d5cad263a5387f77f9ea77315af84d'
+ version '2.3'
+ sha256 '69da212e2972e23e361c93049e4b4505d7f226aff8652192125f078be7eecf7f'
url "http://www.freemacsoft.net/downloads/AppCleaner_#{version}.zip"
name 'AppCleaner'
appcast 'http://www.freemacsoft.net/appcleaner/Updates.xml',
:sha256 => '88e632b01611ad88acf07de8e87f4b839c36dae464109981fba170d625d284e3'
homepage 'http://www.freemacsoft.net/appcleaner/'
- license :unknown # todo: change license and remove this comment; ':unknown' is a machine-generated placeholder
+ license :gratis
app 'AppCleaner.app'
end
|
Update AppCleaner.app to version 2.3
|
diff --git a/Casks/endlesssky.rb b/Casks/endlesssky.rb
index abc1234..def5678 100644
--- a/Casks/endlesssky.rb
+++ b/Casks/endlesssky.rb
@@ -1,6 +1,6 @@ cask :v1 => 'endlesssky' do
- version '0.8.2'
- sha256 '65ae266e629c17b46fa69593fdbb7b318620f4eb68085f135e63046dae6751ad'
+ version '0.8.3'
+ sha256 'f3f96120d6222c8546986d39687af063924ec1bd64671ff54929a571361325f3'
url "https://github.com/endless-sky/endless-sky/releases/download/v#{version}/endless-sky-macosx-#{version}.dmg"
appcast 'https://github.com/endless-sky/endless-sky/releases.atom'
|
Update Endless Sky to v0.8.3
|
diff --git a/app/controllers/concerns/repository_manager.rb b/app/controllers/concerns/repository_manager.rb
index abc1234..def5678 100644
--- a/app/controllers/concerns/repository_manager.rb
+++ b/app/controllers/concerns/repository_manager.rb
@@ -21,7 +21,14 @@ date = params[:snapshot_id] || params[:id]
if not params[:repository_id].nil? and not date.nil?
- @snapshot = @repository.snapshots.where(date: date).first
+ @snapshot = @repository.snapshots.where(date: date)
+
+ if @snapshot.exists?
+ @snapshot = @snapshot.first
+ else
+ @snapshot = @repository.snapshots.last
+ end
+
gon.snapshot = @snapshot
end
end
|
Use latest snapshot if snapshot cannot be found
A snapshot might be selected through the URL that is not available.
Instead of failing all together, the latest snapshot of the repository
is selected. What is still missing is an automated redirection.
Signed-off-by: Konrad Reiche <4ff0213f56e2082fcd8c882d04c546881c579ce4@gmail.com>
|
diff --git a/app/controllers/supporting_pages_controller.rb b/app/controllers/supporting_pages_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/supporting_pages_controller.rb
+++ b/app/controllers/supporting_pages_controller.rb
@@ -1,11 +1,13 @@ class SupportingPagesController < PublicFacingController
+ include PermissionsChecker
+
before_filter :find_policy
before_filter :find_supporting_page, only: [:show]
before_filter :set_analytics_format, only: [:show]
def index
if @policy.supporting_pages.empty?
- render text: "Not found", status: :not_found
+ render_not_found
else
redirect_to policy_supporting_page_path(@policy.document, @policy.supporting_pages.first)
end
@@ -14,22 +16,43 @@ def show
@document = @policy
@recently_changed_documents = Edition.published.related_to(@policy).in_reverse_chronological_order
- set_slimmer_organisations_header(@supporting_page.edition.organisations)
+ set_slimmer_organisations_header(@policy.organisations)
end
- private
+private
+ def render_not_found
+ render text: "Not found", status: :not_found
+ end
def find_policy
- unless @policy = Policy.published_as(params[:policy_id])
- render text: "Not found", status: :not_found
+ if should_preview?
+ @policy = Document.at_slug('Policy', params[:policy_id]).try(:latest_edition)
+ # Fall back to the non-preview behaviour if user isn't allowed to preview
+ @policy = nil unless can_preview?(@policy)
end
+
+ @policy ||= Policy.published_as(params[:policy_id]) or render_not_found
end
def find_supporting_page
- @supporting_page = @policy.supporting_pages.find(params[:id])
+ if should_preview?
+ @supporting_page = Document.at_slug('SupportingPage', params[:id]).try(:latest_edition)
+ render_not_found unless can_preview?(@supporting_page)
+ else
+ @supporting_page = Document.at_slug('SupportingPage', params[:id]).try(:published_edition)
+ render_not_found unless @policy.supporting_pages.include?(@supporting_page)
+ end
end
def analytics_format
:policy
end
+
+ def should_preview?
+ params[:preview]
+ end
+
+ def can_preview?(record)
+ can?(:see, record)
+ end
end
|
Make view and preview of supporting pages work
Also make the preview checking more secure by ensuring the
current user can see the previewed records.
|
diff --git a/migrate/20190826124739_add_well_connected_and_importance_to_country_statistic.rb b/migrate/20190826124739_add_well_connected_and_importance_to_country_statistic.rb
index abc1234..def5678 100644
--- a/migrate/20190826124739_add_well_connected_and_importance_to_country_statistic.rb
+++ b/migrate/20190826124739_add_well_connected_and_importance_to_country_statistic.rb
@@ -1,6 +1,8 @@ class AddWellConnectedAndImportanceToCountryStatistic < ActiveRecord::Migration
def change
- add_column :country_statistics, :well_connected, :float
- add_column :country_statistics, :importance, :float
+ add_column :country_statistics, :percentage_land_well_connected, :float
+ add_column :country_statistics, :percentage_marine_well_connected, :float
+ add_column :country_statistics, :percentage_land_importance, :float
+ add_column :country_statistics, :percentage_marine_importance, :float
end
end
|
Add stats for marine as well
|
diff --git a/app/serializers/api/admin/exchange_serializer.rb b/app/serializers/api/admin/exchange_serializer.rb
index abc1234..def5678 100644
--- a/app/serializers/api/admin/exchange_serializer.rb
+++ b/app/serializers/api/admin/exchange_serializer.rb
@@ -4,9 +4,6 @@ has_many :enterprise_fees, serializer: Api::Admin::EnterpriseFeeSerializer
def variants
- Hash[
- OpenFoodNetwork::Permissions.new(options[:current_user]).
- visible_variants_within(object).map { |v| [v.id, true] }
- ]
+ Hash[ object.variants.map { |v| [v.id, true] } ]
end
end
|
Load actual variants in the exchange, wrong behaviour was implemented in previous two commits
|
diff --git a/spec/unit/mutant/matcher/methods/instance_spec.rb b/spec/unit/mutant/matcher/methods/instance_spec.rb
index abc1234..def5678 100644
--- a/spec/unit/mutant/matcher/methods/instance_spec.rb
+++ b/spec/unit/mutant/matcher/methods/instance_spec.rb
@@ -1,39 +1,40 @@ RSpec.describe Mutant::Matcher::Methods::Instance, '#each' do
- let(:object) { described_class.new(env, Foo) }
+ let(:object) { described_class.new(env, class_under_test) }
let(:env) { Fixtures::TEST_ENV }
subject { object.each { |matcher| yields << matcher } }
let(:yields) { [] }
- module Bar
- def method_d
+ let(:class_under_test) do
+ parent = Module.new do
+ def method_d
+ end
+
+ def method_e
+ end
end
- def method_e
+ Class.new do
+ include parent
+
+ private :method_d
+
+ public
+
+ def method_a
+ end
+
+ protected
+
+ def method_b
+ end
+
+ private
+
+ def method_c
+ end
end
- end
-
- class Foo
- include Bar
-
- private :method_d
-
- public
-
- def method_a
- end
-
- protected
-
- def method_b
- end
-
- private
-
- def method_c
- end
-
end
let(:subject_a) { double('Subject A') }
@@ -45,11 +46,11 @@ before do
matcher = Mutant::Matcher::Method::Instance
allow(matcher).to receive(:new)
- .with(env, Foo, Foo.instance_method(:method_a)).and_return([subject_a])
+ .with(env, class_under_test, class_under_test.instance_method(:method_a)).and_return([subject_a])
allow(matcher).to receive(:new)
- .with(env, Foo, Foo.instance_method(:method_b)).and_return([subject_b])
+ .with(env, class_under_test, class_under_test.instance_method(:method_b)).and_return([subject_b])
allow(matcher).to receive(:new)
- .with(env, Foo, Foo.instance_method(:method_c)).and_return([subject_c])
+ .with(env, class_under_test, class_under_test.instance_method(:method_c)).and_return([subject_c])
end
it 'should yield expected subjects' do
|
Redefine class in instance matcher spec
- rspec describes are not classes, so the class was defined globally
- this caused warnings for other matchers
|
diff --git a/config.ru b/config.ru
index abc1234..def5678 100644
--- a/config.ru
+++ b/config.ru
@@ -12,7 +12,6 @@ :always_check => true
)
use Sass::Plugin::Rack
- use Rack::Reloader
end
dbconfig = YAML.load(File.read('config/database.yml'))
Kalimba::Models::Base.establish_connection dbconfig[environment]
|
Remove reloader, doesn't work with camping
|
diff --git a/recipes/final.rb b/recipes/final.rb
index abc1234..def5678 100644
--- a/recipes/final.rb
+++ b/recipes/final.rb
@@ -38,3 +38,17 @@ members 'git'
append true
end
+
+# Thanks http://programster.blogspot.ca/2014/09/docker-implementing-container-memory.html
+
+bash 'remove warning when adding memory limits for docker containers' do
+ user 'root'
+ cwd '/tmp'
+ code <<-EOH
+ SEARCH='GRUB_CMDLINE_LINUX=""'
+ REPLACE='GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1"'
+ FILEPATH="/etc/default/grub"
+ sed -i "s;$SEARCH;$REPLACE;" $FILEPATH
+ update-grub
+ EOH
+end
|
Update Grub to fix memory allocation warning.
|
diff --git a/app/models/competitions/oregon_womens_prestige_series.rb b/app/models/competitions/oregon_womens_prestige_series.rb
index abc1234..def5678 100644
--- a/app/models/competitions/oregon_womens_prestige_series.rb
+++ b/app/models/competitions/oregon_womens_prestige_series.rb
@@ -13,6 +13,8 @@ def categories_for(race)
if race.name == "Women 1/2"
super << Category.where(name: "Pro/1/2 Women").first
+ elsif race.name == "Women 3"
+ super << Category.where(name: "Category 3 Women").first
else
super
end
|
Add Category 3 Women to OWPS
|
diff --git a/lib/breaker/rails_cache/repo.rb b/lib/breaker/rails_cache/repo.rb
index abc1234..def5678 100644
--- a/lib/breaker/rails_cache/repo.rb
+++ b/lib/breaker/rails_cache/repo.rb
@@ -25,10 +25,11 @@ def upsert(attributes)
fuse = store.find attributes.fetch(:name)
fuse.update attributes
+ fuse
end
def count
- store.length
+ store.count
end
def first
|
Fix a bug with returning the fuse and calculating the size of the store
|
diff --git a/lib/contextio/email_settings.rb b/lib/contextio/email_settings.rb
index abc1234..def5678 100644
--- a/lib/contextio/email_settings.rb
+++ b/lib/contextio/email_settings.rb
@@ -1,10 +1,34 @@ module ContextIO
class EmailSettings < APIResource
def self.discover_for(email_address, source_type = 'imap')
- attrs = ContextIO::API.request(:get, 'discovery', email_address: email_address, source_type: source_type)
+ attrs = ContextIO::API.request(:get, 'discovery', email: email_address, source_type: source_type)
new(attrs)
end
attr_reader :email, :found, :type, :documentation, :imap
+
+ def found?
+ !!found
+ end
+
+ def server
+ imap['server']
+ end
+
+ def username
+ imap['username']
+ end
+
+ def port
+ imap['port']
+ end
+
+ def oauth?
+ !!imap['oauth']
+ end
+
+ def uses_ssl?
+ !!imap['use_ssl']
+ end
end
end
|
Fix API param name and sugar over nested attributes.
|
diff --git a/slack-bot-server/server.rb b/slack-bot-server/server.rb
index abc1234..def5678 100644
--- a/slack-bot-server/server.rb
+++ b/slack-bot-server/server.rb
@@ -13,7 +13,7 @@ def restart!(wait = 1)
# when an integration is disabled, a live socket is closed, which causes the default behavior of the client to restart
# it would keep retrying without checking for account_inactive or such, we want to restart via service which will disable an inactive team
- EM.next_tick do
+ EM.defer do
logger.info "#{team.name}: socket closed, restarting ..."
SlackBotServer::Service.restart! team, self, wait
client.owner = team
|
Improve restart on close performance.
|
diff --git a/test/models/post_test.rb b/test/models/post_test.rb
index abc1234..def5678 100644
--- a/test/models/post_test.rb
+++ b/test/models/post_test.rb
@@ -30,4 +30,24 @@ assert_equal(["は数値で入力してください"], category.errors[:order])
end
end
+
+ sub_test_case "relation" do
+ setup do
+ @author = @site.authors.create!(name: "name",
+ responsibility: "responsibility",
+ title: "title",
+ affiliation: "affiliation")
+ @post = @site.posts.create!(title: "title", body: "body")
+ @post.author = @author
+ @post.save!
+ end
+
+ def test_destroy
+ assert_equal(Author.count, 1)
+ assert_equal(Post.count, 1)
+ @author.destroy
+ assert_equal(Author.count, 0)
+ assert_equal(Post.count, 1)
+ end
+ end
end
|
test: Destroy author that has posts
|
diff --git a/xpath.gemspec b/xpath.gemspec
index abc1234..def5678 100644
--- a/xpath.gemspec
+++ b/xpath.gemspec
@@ -14,7 +14,7 @@ s.description = 'XPath is a Ruby DSL for generating XPath expressions'
s.license = 'MIT'
- s.files = Dir.glob('{lib,spec}/**/*') + %w[README.md]
+ s.files = Dir.glob('lib/**/*') + %w[README.md]
s.homepage = 'https://github.com/teamcapybara/xpath'
s.summary = 'Generate XPath expressions from Ruby'
|
Remove spec files from bundled gem
|
diff --git a/test/test_constructor.rb b/test/test_constructor.rb
index abc1234..def5678 100644
--- a/test/test_constructor.rb
+++ b/test/test_constructor.rb
@@ -4,8 +4,9 @@
def test_build_fail
- spore = Spore.new() rescue nil
- assert_nil spore
+ assert_raise ArgumentError do
+ spore = Spore.new()
+ end
end
def test_build_github_json
|
Use assert_raise to catch an exception in tests
|
diff --git a/.chef/knife.rb b/.chef/knife.rb
index abc1234..def5678 100644
--- a/.chef/knife.rb
+++ b/.chef/knife.rb
@@ -1,3 +1,21 @@ current_dir = File.dirname(__FILE__)
+
+log_level :debug
+log_location STDOUT
+node_name "odi"
+client_key "#{current_dir}/odi.pem"
+validation_client_name "chef-validator"
+validation_key "#{current_dir}/chef-validator.pem"
+chef_server_url "https://chef.theodi.org"
+cache_type "BasicFile"
+cookbook_path [
+ '#{current_dir}/../cookbooks',
+ '#{current_dir}/../site-cookbooks'
+ ]
+
cache_options(:path => "#{current_dir}/checksums")
-verbose_logging true
+
+cookbook_copyright "The Open Data Institute"
+cookbook_license "mit"
+cookbook_email "tech@theodi.org"
+readme_format "md"
|
Bring in bits from cuke-chef
|
diff --git a/lib/esri/cli/cmd/dataset_cmd.rb b/lib/esri/cli/cmd/dataset_cmd.rb
index abc1234..def5678 100644
--- a/lib/esri/cli/cmd/dataset_cmd.rb
+++ b/lib/esri/cli/cmd/dataset_cmd.rb
@@ -15,7 +15,7 @@ dataset.desc 'Links'
dataset.command :links do |links|
links.action do
- pp Esri::Dataset.fetch_links
+ puts Esri::Dataset.fetch_links
end
end
end
|
Use puts instead of pp
|
diff --git a/lib/flame/dispatcher/request.rb b/lib/flame/dispatcher/request.rb
index abc1234..def5678 100644
--- a/lib/flame/dispatcher/request.rb
+++ b/lib/flame/dispatcher/request.rb
@@ -33,11 +33,8 @@ env.each_with_object({}) do |(key, value), result|
next unless key.start_with?(HEADER_PREFIX)
- ## TODO: Replace `String#[]` with `#delete_prefix`
- ## after Ruby < 2.5 dropping
camelized_key =
- key[HEADER_PREFIX.size..-1].downcase.tr('_', '/')
- .camelize.gsub('::', '-')
+ key.delete_prefix(HEADER_PREFIX).downcase.tr('_', '/').camelize.gsub('::', '-')
result[camelized_key] = value
end
|
Complete `TODO` after Ruby < 2.5 dropping
|
diff --git a/lib/frisky/models/repository.rb b/lib/frisky/models/repository.rb
index abc1234..def5678 100644
--- a/lib/frisky/models/repository.rb
+++ b/lib/frisky/models/repository.rb
@@ -2,15 +2,18 @@ module Model
class Repository < ProxyBase
attr_accessor :homepage, :watchers_count, :html_url, :owner, :master_branch,
- :forks_count, :git_url, :full_name, :name, :created_at, :url
+ :forks_count, :git_url, :full_name, :name, :created_at, :url,
+ :forked, :description
fetch_key :full_name
fetch_autoload :homepage, :watchers_count, :html_url, :owner, :master_branch,
- :forks_count, :git_url, :full_name, :name, :created_at, :url
+ :forks_count, :git_url, :full_name, :name, :created_at, :url,
+ :description
fallback_fetch { |args| Octokit.repo(args[:full_name]) }
after_fallback_fetch do |obj|
self.owner = Person.soft_fetch(obj.owner)
+ self.forked = obj['fork']
end
proxy_methods :name, :url, :owner
|
Rename fork method to stop forking myself
|
diff --git a/lib/lib/config/custom-routes.rb b/lib/lib/config/custom-routes.rb
index abc1234..def5678 100644
--- a/lib/lib/config/custom-routes.rb
+++ b/lib/lib/config/custom-routes.rb
@@ -1,14 +1,10 @@ if Rails.env != "test"
- ActionController::Routing::Routes.draw do |map|
+ Alaveteli::Application.routes.draw do
# Additional help pages
- map.with_options :controller => 'help' do |help|
- help.help_help_out '/help/help_out', :action => 'help_out'
- help.help_right_to_know '/help/right_to_know', :action => 'right_to_know'
- end
+ match '/help/help_out' => 'help#help_help_out', :as => 'help_out'
+ match '/help/right_to_know' => 'help#help_right_to_know', :as => 'right_to_know'
# We want to start by showing the public bodies categories and search only
- map.with_options :controller => 'public_body' do |body|
- body.body_index "/body/", :action => "index"
- end
+ match '/body/' => 'public_body#body_index', :as => "index"
end
end
|
Update routes to new Rails 3 format
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.