diff stringlengths 65 26.7k | message stringlengths 7 9.92k |
|---|---|
diff --git a/acts_as_tenant.gemspec b/acts_as_tenant.gemspec
index abc1234..def5678 100644
--- a/acts_as_tenant.gemspec
+++ b/acts_as_tenant.gemspec
@@ -15,7 +15,7 @@
spec.require_paths = ["lib"]
- spec.add_runtime_dependency "request_store", ">= 1.0.5"
+ spec.add_dependency "request_store", ">= 1.0.5"
spec.add_dependency "rails", ">= 5.2"
spec.add_development_dependency "rspec", ">=3.0"
| Rename runtime dependency to dependency since they're just aliased
|
diff --git a/install.rb b/install.rb
index abc1234..def5678 100644
--- a/install.rb
+++ b/install.rb
@@ -37,7 +37,7 @@ end
def destination_filename
- '.' + @source_pathname.basename('.*')
+ '.' + @source_pathname.basename('.*').to_s
end
end
| Fix TypeError exception raised by Ruby 2.0.
|
diff --git a/app/models/proof/tree.rb b/app/models/proof/tree.rb
index abc1234..def5678 100644
--- a/app/models/proof/tree.rb
+++ b/app/models/proof/tree.rb
@@ -5,9 +5,10 @@ end
def as_json opts={}
- # FIXME: cache by space
+ # FIXME: cache tree by space
+ # FIXME: cache theorem names
# FIXME: use rabl?
- nodes = @space.traits.includes(:proof).map do |trait|
+ nodes = @space.traits.includes(:property, :value, :proof => :theorem).map do |trait|
node = {
name: trait.assumption_description,
id: trait.id
| Fix another n+1 ... kindof
|
diff --git a/app/models/repository.rb b/app/models/repository.rb
index abc1234..def5678 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -3,6 +3,20 @@ has_many :reminders
uniquify :access_token, :length => 10
+
+ class << self
+ def with_access_by(username, access_type = :admin)
+ user = User.find_by!(username: username)
+ Repository.all.select do |repo|
+ access = begin
+ user.permissions(repo.to_s).try(access_type)
+ rescue Octokit::NotFound => ex
+ false
+ end
+ !!access
+ end
+ end
+ end
def next_pending sha = nil
query = commits.pending.order("commited_at ASC")
| Add with_access_by scope for Repository |
diff --git a/test/features/approve_services_test.rb b/test/features/approve_services_test.rb
index abc1234..def5678 100644
--- a/test/features/approve_services_test.rb
+++ b/test/features/approve_services_test.rb
@@ -0,0 +1,36 @@+require "test_helper"
+require_relative 'support/ui_test_helper'
+
+class ApproveServiceTest < Capybara::Rails::TestCase
+ include UITestHelper
+ include Warden::Test::Helpers
+ after { Warden.test_reset! }
+
+ test "GobDigital User can approve specific service version" do
+ service_v = service_versions(:servicio1_v1)
+ assert service_v.status == "proposed"
+ login_as users(:pablito), scope: :user
+
+ visit organization_service_service_version_path(service_v.organization, service_v.service, service_v)
+ assert_button ('Aprobar')
+ click_button ('Aprobar')
+ assert_content 'Servicios por aprobar'
+ assert ServiceVersion.where(id: service_v.id).first.status == "current"
+ assert_equal 1, users(:pablito).unread_notifications
+ end
+
+ test "GobDigital User can approve a service version from list" do
+ login_as users(:pablito), scope: :user
+ visit root_path
+ find('#user-menu').click
+ find_link('menu-pending-approval').click
+ page.find(:xpath, '//table/tbody/tr[1]').click
+ #find(:xpath, "//table/tr").click
+ assert_button ('Aprobar')
+ click_button ('Aprobar')
+ assert_content 'Servicios por aprobar'
+ assert ServiceVersion.where(id: service_versions(:servicio1_v1).id).first.status == "current"
+ assert_equal 1, users(:pablito).unread_notifications
+ end
+
+end
| Add test for Approve Service version
|
diff --git a/guides/config/deploy.rb b/guides/config/deploy.rb
index abc1234..def5678 100644
--- a/guides/config/deploy.rb
+++ b/guides/config/deploy.rb
@@ -27,9 +27,9 @@ namespace :deploy do
desc "Builds static html for guides"
task :build_guides do
- cmd = "cd #{release_path} && bundle exec guides build --clean"
+ cmd = "cd #{release_path} && bundle exec guides build --clean --ga"
if exists?(:edge)
- cmd << " --edge --ga"
+ cmd << " --edge"
end
run cmd
end
| Include GA for edge and stable
|
diff --git a/spec/functions/get_rc_conf_vlan_spec.rb b/spec/functions/get_rc_conf_vlan_spec.rb
index abc1234..def5678 100644
--- a/spec/functions/get_rc_conf_vlan_spec.rb
+++ b/spec/functions/get_rc_conf_vlan_spec.rb
@@ -0,0 +1,18 @@+require 'spec_helper'
+
+describe 'get_rc_conf_vlan' do
+ context 'with a simple config' do
+ desired = ["vlan 1", "vlandev em0"]
+
+ config = {
+ "name" => 'vlan1',
+ "description" => "Trees",
+ "device" => 'em0',
+ "id" => '1',
+ "address" => [
+ '10.0.1.12/24',
+ ],
+ }
+ it { should run.with_params(config).and_return(desired) }
+ end
+end
| Add bassing spec for basic vlan configuration
|
diff --git a/spec/support/helpers/session_helpers.rb b/spec/support/helpers/session_helpers.rb
index abc1234..def5678 100644
--- a/spec/support/helpers/session_helpers.rb
+++ b/spec/support/helpers/session_helpers.rb
@@ -4,7 +4,7 @@ visit new_user_registration_path
fill_in "Email", with: email
fill_in "Password", with: password
- fill_in "Password confirmation", :with => confirmation
+ fill_in "Password confirmation", with: confirmation
click_button "Sign up"
end
| Use the new Ruby 1.9 hash syntax.
|
diff --git a/app/models/pame_evaluation.rb b/app/models/pame_evaluation.rb
index abc1234..def5678 100644
--- a/app/models/pame_evaluation.rb
+++ b/app/models/pame_evaluation.rb
@@ -4,12 +4,4 @@ has_and_belongs_to_many :countries
validates :methodology, :year, :metadata_id, :url, presence: true
-
- def visible
- if (protected_area.nil? && restricted) || protected_area.present?
- true
- else
- false
- end
- end
end
| Remove visible method from pame evaluation model
|
diff --git a/app/models/hackbot/interactions/gifs.rb b/app/models/hackbot/interactions/gifs.rb
index abc1234..def5678 100644
--- a/app/models/hackbot/interactions/gifs.rb
+++ b/app/models/hackbot/interactions/gifs.rb
@@ -1,20 +1,16 @@ module Hackbot
module Interactions
- class Gifs < Hackbot::Interactions::Channel
- def self.should_start?(event, team)
- event[:type].eql?('message') &&
- mentions_command?(event, team, 'gif')
- end
+ class Gifs < Command
+ TRIGGER = /gif ?(?<query>.+)?/
def start(event)
- query = event_to_query event
- if query.empty?
+ query = captures(event)[:query]
+
+ if query.present?
+ try_sending_gif(query)
+ else
msg_channel copy('start.invalid')
-
- return :finish
end
-
- try_sending_gif(query)
end
private
@@ -27,13 +23,6 @@ else
send_gif(copy('start.valid'), gif[:url])
end
- end
-
- def event_to_query(event)
- event[:text]
- .sub(/#{team[:bot_username]}/i, '')
- .sub(/<@#{team[:bot_user_id]}>/i, '')
- .sub(/gif/i, '').strip
end
def send_gif(text, url)
| Convert Hackbot::Interactions::Gifs to a Command
|
diff --git a/app/controllers/polls.rb b/app/controllers/polls.rb
index abc1234..def5678 100644
--- a/app/controllers/polls.rb
+++ b/app/controllers/polls.rb
@@ -3,8 +3,8 @@ erb :'polls/index'
end
-get'/polls/:poll_id/responses' do
- @poll = Poll.find(params[:poll_id])
+get'/polls/:poll_id/responses' do |id|
+ @poll = Poll.find(id)
erb :'polls/show'
end
| Update route to shorten parameter name
|
diff --git a/app/controllers/podcasts_controller.rb b/app/controllers/podcasts_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/podcasts_controller.rb
+++ b/app/controllers/podcasts_controller.rb
@@ -2,7 +2,7 @@ def index
@title = 'DojoCast'
@desc = 'Highlight people around CoderDojo communities by Podcast 📻✨'
- @episodes = Podcast.all
+ @episodes = Podcast.all.sort_by{|episode| episode.filename.rjust(3, '0')}
@url = request.url
end
| Sort episodes up to 3-digit episodes by ascending order
|
diff --git a/app/controllers/telegram_controller.rb b/app/controllers/telegram_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/telegram_controller.rb
+++ b/app/controllers/telegram_controller.rb
@@ -3,6 +3,8 @@
class TelegramController < ApplicationController
+ protect_from_forgery with: :null_session
+
def index
successful = send_message 50886815, params
render :json => {:ok => successful}
| Make telegram controller work with stateless POST requests
|
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,17 +2,11 @@
describe User do
- let(:user) { FactoryGirl.build(:user) }
-
- it "has valid factory" do
- FactoryGirl.build(:user).should be_valid
- end
-
describe "validation" do
- let(:user) { FactoryGirl.create(:user) }
+ let(:user) { create(:user) }
it "validates nickname uniqueness" do
- new_user = FactoryGirl.build(:user)
+ new_user = build(:user)
new_user.nickname = user.nickname
new_user.should_not be_valid
@@ -21,6 +15,8 @@ end
describe '#add_user_token' do
+ let(:user) { build(:user) }
+
before { user.save }
context "when user doesn't have given token" do
| Remove unnecessary test for user factory
|
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,7 +2,67 @@ require 'rails_helper'
describe User do
+ before(:each) do
+ @user = build(:user)
+ end
+
it 'has a valid factory' do
expect(create(:user)).to be_valid
end
+
+ context 'usernames' do
+ it 'should strip whitespace at the ends' do
+ @user.username = ' hello '
+ @user.save
+ expect(@user.username).to eq('hello')
+ end
+
+ describe 'cannot' do
+ it 'have whitespace' do
+ @user.username = 'hello world'
+ expect(@user).to_not be_valid
+ end
+ end
+
+ describe 'can' do
+ it 'can have underscores' do
+ @user.username = 'hello_world'
+ expect(@user).to be_valid
+ end
+
+ it 'can have dots' do
+ @user.username = 'hello.world'
+ expect(@user).to be_valid
+ end
+
+ it 'can have dashes' do
+ @user.username = 'hello-world'
+ expect(@user).to be_valid
+ end
+ end
+ end
+
+ context 'emails' do
+ it 'should not be empty' do
+ @user.email = ''
+ expect(@user).to_not be_valid
+ end
+
+ it 'should not have two @s ' do
+ @user.email = 'hello@world@lollolol.com'
+ expect(@user).to_not be_valid
+ end
+ end
+
+ context 'passwords' do
+ it 'shuold not be empty' do
+ @user.password = ''
+ expect(@user).to_not be_valid
+ end
+
+ it 'should not be less than 8 characters' do
+ @user.password = 'a' * 7
+ expect(@user).to_not be_valid
+ end
+ end
end
| Write username and email address tests for User model
|
diff --git a/spec/tic_tac_toe_spec.rb b/spec/tic_tac_toe_spec.rb
index abc1234..def5678 100644
--- a/spec/tic_tac_toe_spec.rb
+++ b/spec/tic_tac_toe_spec.rb
@@ -16,8 +16,13 @@ @game = TicTacToe::Board.new
end
- it 'initially has empty positions' do
- expect(@game.pos [1,1]).to eq(" ")
+ it 'initially has 9 empty positions' do
+ (1..3).each do |x|
+ (1..3).each do |y|
+ expect(@game.pos [x,y]).to eq(" ")
+ end
+ end
+
end
end
end
| Test all 9 positions are empty
|
diff --git a/app/models/file_depot_ftp_anonymous.rb b/app/models/file_depot_ftp_anonymous.rb
index abc1234..def5678 100644
--- a/app/models/file_depot_ftp_anonymous.rb
+++ b/app/models/file_depot_ftp_anonymous.rb
@@ -1,12 +1,4 @@ class FileDepotFtpAnonymous < FileDepotFtp
- def self.requires_credentials?
- true
- end
-
- def requires_support_case?
- false
- end
-
def login_credentials
["anonymous", "anonymous"]
end
| Remove redundant methods implemented in parent class
|
diff --git a/app/models/material.rb b/app/models/material.rb
index abc1234..def5678 100644
--- a/app/models/material.rb
+++ b/app/models/material.rb
@@ -19,6 +19,10 @@ def filename=(filename)
self.file.original_name = filename
end
+
+ def title
+ self.filename
+ end
def filesize
self.file.file_file_size
| Add title method to duck type.
|
diff --git a/app/models/contractor.rb b/app/models/contractor.rb
index abc1234..def5678 100644
--- a/app/models/contractor.rb
+++ b/app/models/contractor.rb
@@ -1,3 +1,6 @@ class Contractor < ActiveRecord::Base
has_many :contracts, inverse_of: :contractor
+
+ validates :name, :abn, presence: true
+ validates :abn, uniqueness: true
end
| Add basic validation to Contractor
|
diff --git a/app/models/submission.rb b/app/models/submission.rb
index abc1234..def5678 100644
--- a/app/models/submission.rb
+++ b/app/models/submission.rb
@@ -4,7 +4,7 @@ validates_inclusion_of :first_time, in: [true, false]
validates :age, numericality: { greater_than: 0, less_than: 110 }
validates_format_of :email, with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i
- validates :email, uniqueness: true
+ validates :email, uniqueness: { case_sensitive: false }
validates :full_name, :email, :codecademy_username, length: { maximum: 50 }
validates :description, :goals, :problems, length: { maximum: 255 }
| Change email uniqueness validation so it does take into account capitalization
|
diff --git a/app/models/submission.rb b/app/models/submission.rb
index abc1234..def5678 100644
--- a/app/models/submission.rb
+++ b/app/models/submission.rb
@@ -14,16 +14,25 @@ alias_method :repo, :repository
private
+ #
+ # The given lab {lab} must be active
+ #
def lab_access
if lab and not lab.active?
errors[:lab_access] << "failed, lab not accessible"
end
end
+ #
+ # Use last commit from {repository} as {commit_hash}
+ #
def fetch_commit
self.commit_hash ||= lab_has_group.repository.head_candidate.commit
end
+ #
+ # Does the given commit {commit_hash} exist?
+ #
def existence_of_commit_hash
path = lab_has_group.repository.try(:full_repository_path)
Dir.chdir(path) do
| Add comments to validation methods in Submission model
|
diff --git a/i18n.gemspec b/i18n.gemspec
index abc1234..def5678 100644
--- a/i18n.gemspec
+++ b/i18n.gemspec
@@ -13,6 +13,13 @@ s.description = "New wave Internationalization support for Ruby."
s.license = "MIT"
+ s.metadata = {
+ 'bug_tracker_uri' => 'https://github.com/svenfuchs/i18n/issues',
+ 'changelog_uri' => 'https://github.com/svenfuchs/i18n/releases',
+ 'documentation_uri' => 'https://guides.rubyonrails.org/i18n.html',
+ 'source_code_uri' => 'https://github.com/svenfuchs/i18n',
+ }
+
s.files = Dir.glob("{gemfiles,lib,test}/**/**") + %w(README.md MIT-LICENSE)
s.platform = Gem::Platform::RUBY
s.require_path = 'lib'
| Add project metadata to the gemspec
|
diff --git a/week-4/address/format_address_spec.rb b/week-4/address/format_address_spec.rb
index abc1234..def5678 100644
--- a/week-4/address/format_address_spec.rb
+++ b/week-4/address/format_address_spec.rb
@@ -0,0 +1,16 @@+require_relative "my_solution"
+
+describe "make_address" do
+ it 'is defined as a method' do
+ expect(defined?(make_address)).to eq 'method'
+ end
+
+ it 'accepts four parameters' do
+ expect(method(:make_address).arity).to eq 4
+ end
+
+ it 'returns the properly formatted address string' do
+ output_string = "You live at 633 Folsom St., in the beautiful city of San Francisco, CA. Your zip is 94107."
+ expect(make_address("633 Folsom St.","San Francisco","CA",94107)).to eq output_string
+ end
+end | Add rspec file for challenge 4.3 release 4
|
diff --git a/config/initializers/csv_renderer.rb b/config/initializers/csv_renderer.rb
index abc1234..def5678 100644
--- a/config/initializers/csv_renderer.rb
+++ b/config/initializers/csv_renderer.rb
@@ -1,4 +1,4 @@ # frozen_string_literal: true
ActionController::Renderers.add :csv do |object, _|
- send_data object.csv, type: Mime::CSV, disposition: 'attachment; filename=data.csv'
+ send_data object.csv, type: Mime[:csv], disposition: 'attachment; filename=data.csv'
end
| Remove `Mime` access deprecation warning
|
diff --git a/config/initializers/time_formats.rb b/config/initializers/time_formats.rb
index abc1234..def5678 100644
--- a/config/initializers/time_formats.rb
+++ b/config/initializers/time_formats.rb
@@ -0,0 +1,6 @@+Time::DATE_FORMATS[:short_ordinal] = lambda do |time|
+ time.strftime("#{time.day.ordinalize} %B")
+end
+Time::DATE_FORMATS[:medium_ordinal] = lambda do |time|
+ time.strftime("#{time.day.ordinalize} %B %Y")
+end
| Add new Time formats for short and medium ordinals
|
diff --git a/ivy-serializers.gemspec b/ivy-serializers.gemspec
index abc1234..def5678 100644
--- a/ivy-serializers.gemspec
+++ b/ivy-serializers.gemspec
@@ -20,5 +20,5 @@ spec.add_development_dependency 'json-schema-rspec', '~> 0.0.4'
spec.add_development_dependency 'rake'
spec.add_development_dependency 'rspec', '~> 3.5'
- spec.add_development_dependency 'simplecov', '~> 0.19.0'
+ spec.add_development_dependency 'simplecov', '~> 0.20.0'
end
| Update simplecov requirement from ~> 0.19.0 to ~> 0.20.0
Updates the requirements on [simplecov](https://github.com/simplecov-ruby/simplecov) to permit the latest version.
- [Release notes](https://github.com/simplecov-ruby/simplecov/releases)
- [Changelog](https://github.com/simplecov-ruby/simplecov/blob/main/CHANGELOG.md)
- [Commits](https://github.com/simplecov-ruby/simplecov/compare/v0.19.0...v0.20.0)
Signed-off-by: dependabot-preview[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@dependabot.com> |
diff --git a/lib/cex.rb b/lib/cex.rb
index abc1234..def5678 100644
--- a/lib/cex.rb
+++ b/lib/cex.rb
@@ -2,7 +2,7 @@ require "cex/net"
require "cex/model"
require "cex/orders"
-require "cex/executions"
+require "cex/transactions"
require "cex/balances"
module Cex
| Fix bug: annot load such file
|
diff --git a/auth/lib/tasks/auth.rake b/auth/lib/tasks/auth.rake
index abc1234..def5678 100644
--- a/auth/lib/tasks/auth.rake
+++ b/auth/lib/tasks/auth.rake
@@ -2,7 +2,7 @@ namespace :admin do
desc "Create admin username and password"
task :create => :environment do
- require File.join(Rails.root, 'db', 'sample', 'users.rb')
+ require File.join(File.dirname(__FILE__), '..', '..', 'db', 'default', 'users.rb')
end
end
end | Fix db:admin:create task to locate the correct users.rb file
|
diff --git a/spec/adhearsion/punchblock_plugin_spec.rb b/spec/adhearsion/punchblock_plugin_spec.rb
index abc1234..def5678 100644
--- a/spec/adhearsion/punchblock_plugin_spec.rb
+++ b/spec/adhearsion/punchblock_plugin_spec.rb
@@ -0,0 +1,11 @@+require 'spec_helper'
+
+module Adhearsion
+ describe PunchblockPlugin do
+ it "should make the client accessible from the Initializer" do
+ PunchblockPlugin::Initializer.client = :foo
+ PunchblockPlugin.client.should == :foo
+ PunchblockPlugin::Initializer.client = nil
+ end
+ end
+end
| [FEATURE] Add test coverage for client accessor on PunchblockPlugin |
diff --git a/spec/dummy/db/schema.rb b/spec/dummy/db/schema.rb
index abc1234..def5678 100644
--- a/spec/dummy/db/schema.rb
+++ b/spec/dummy/db/schema.rb
@@ -13,7 +13,7 @@
ActiveRecord::Schema.define(version: 20141126120426) do
- create_table "users", force: true do |t|
+ create_table "users", force: :cascade do |t|
t.string "name"
t.string "email"
t.string "password"
| Remove extra .css extension in files
|
diff --git a/spec/factories/picks.rb b/spec/factories/picks.rb
index abc1234..def5678 100644
--- a/spec/factories/picks.rb
+++ b/spec/factories/picks.rb
@@ -8,7 +8,7 @@ multiplier { 3 }
end
- factory :failed_pick do
+ factory :failed_pick, class: Pick do
draw_date { Faker::Time.between(30.days.ago, Time.now) }
password { Faker::Internet.password }
game { "powerball" }
| Add subclass to factory :failed_pick.
|
diff --git a/lib/bot.rb b/lib/bot.rb
index abc1234..def5678 100644
--- a/lib/bot.rb
+++ b/lib/bot.rb
@@ -6,9 +6,9 @@
class WelcomePlugin
include Cinch::Plugin
- listen_to :PRIVMSG, use_prefix: false, method: :doWelcome
+ match /(.*)/i, react_on: :channel, use_prefix: false, method: :doWelcome
- def doWelcome(m,bleh)
+ def doWelcome(m, bleh)
if m.channel == "#debug"
Channel("#Situation_Room").send("A message was sent to #debug")
end
| Make it a match type
|
diff --git a/test/integration/table_content_test.rb b/test/integration/table_content_test.rb
index abc1234..def5678 100644
--- a/test/integration/table_content_test.rb
+++ b/test/integration/table_content_test.rb
@@ -28,7 +28,7 @@ within :css, '#call_list_content' do
assert has_content? @patient.primary_phone_display
assert has_content? @patient.name
- assert has_content? 3.days.from_now.utc.display_date
+ assert has_content? 3.days.from_now.utc.strftime('%Y-%m-%d')
assert has_content? @patient.pregnancy.last_menstrual_period_display_short
# TODO: has remove, phone clicky
end
| Test fluke after 4:00 Pacific time - fixed date display
|
diff --git a/test/rubygems/comparator/test_utils.rb b/test/rubygems/comparator/test_utils.rb
index abc1234..def5678 100644
--- a/test/rubygems/comparator/test_utils.rb
+++ b/test/rubygems/comparator/test_utils.rb
@@ -0,0 +1,33 @@+require 'rubygems/test_case'
+require 'rubygems/comparator'
+
+class TestGemComparatorUtils < Gem::TestCase
+ def setup
+ super
+ # This should pull in Gem::Comparator::Utils
+ @test_comparator = Class.new(Gem::Comparator::Base).new
+ end
+
+ def test_param_exist?
+ params = (Gem::Comparator::Utils::SPEC_PARAMS +
+ Gem::Comparator::Utils::SPEC_FILES_PARAMS +
+ Gem::Comparator::Utils::DEPENDENCY_PARAMS +
+ Gem::Comparator::Utils::GEMFILE_PARAMS)
+
+ params.each do |param|
+ assert_equal true, @test_comparator.send(:param_exists?, param)
+ end
+
+ assert_equal false, @test_comparator.send(:param_exists?, 'i_dont_exist')
+ end
+
+ def test_filter_params
+ params = Gem::Comparator::Utils::SPEC_PARAMS
+ assert_equal ['license'], @test_comparator.send(:filter_params, params, 'license')
+ end
+
+ def test_filter_for_brief_mode
+ exclude = Gem::Comparator::Utils::FILTER_WHEN_BRIEF + ['not_excluded']
+ assert_equal ['not_excluded'], @test_comparator.send(:filter_for_brief_mode, exclude)
+ end
+end
| Add tests for Utils class
|
diff --git a/lib/air_blade/air_budd/form_helper.rb b/lib/air_blade/air_budd/form_helper.rb
index abc1234..def5678 100644
--- a/lib/air_blade/air_budd/form_helper.rb
+++ b/lib/air_blade/air_budd/form_helper.rb
@@ -19,12 +19,12 @@ # TODO: complete this. See README.
# TODO: DRY with FormBuilder#button implementation.
def link_to_form(purpose, options = {}, html_options = nil)
- icon = case purpose
- when :new then 'add'
- when :edit then 'pencil'
- when :delete then 'cross' # TODO: delete should be a button, not a link
- when :cancel then 'arrow_undo'
- end
+ icon = options.delete(:icon) || case purpose
+ when :new then 'add'
+ when :edit then 'pencil'
+ when :delete then 'cross' # TODO: delete should be a button, not a link
+ when :cancel then 'arrow_undo'
+ end
if options.kind_of? String
url = options
else
| Allow any icon to be specified in the link.
|
diff --git a/Casks/intellij-idea-eap.rb b/Casks/intellij-idea-eap.rb
index abc1234..def5678 100644
--- a/Casks/intellij-idea-eap.rb
+++ b/Casks/intellij-idea-eap.rb
@@ -1,6 +1,6 @@ cask :v1 => 'intellij-idea-eap' do
- version '141.588.1'
- sha256 '4748d0785eb9e7df24fe43524ee196db69ebde50125eb2d6879702eecc64a604'
+ version '141.1192.2'
+ sha256 '3a31b5883c6a0c10667cd896c99fec723d4f862e9378ce64ee4b8634ebed3c82'
url "http://download-cf.jetbrains.com/idea/ideaIU-#{version}.dmg"
homepage 'https://confluence.jetbrains.com/display/IDEADEV/IDEA+14.1+EAP'
| Upgrade Intellij Idea EAP to 141.1192.2
Signed-off-by: Koichi Shiraishi <41a18128582fec5418c0a92661f7d4b13d21d912@gmail.com>
|
diff --git a/narwhal.rb b/narwhal.rb
index abc1234..def5678 100644
--- a/narwhal.rb
+++ b/narwhal.rb
@@ -3,10 +3,17 @@ require 'redis'
require './increment_count'
-Resque.redis = Redis.new
+# connect to Redis
+r = Redis.new
+
+# initialize count
+r.set('narwhal_count', 0)
+
+# make sure Resque knows what to do
+Resque.redis = r
get '/' do
- "App is alive, counter is #{Redis.new.get('narwhal_count')}"
+ "App is alive, counter is #{r.get('narwhal_count')}"
end
get '/up' do
| Add a little more startup logic
|
diff --git a/LeetCode/remove_n_element_from_list.rb b/LeetCode/remove_n_element_from_list.rb
index abc1234..def5678 100644
--- a/LeetCode/remove_n_element_from_list.rb
+++ b/LeetCode/remove_n_element_from_list.rb
@@ -16,18 +16,18 @@ end
def remove_k(root, k)
- len = 0
- it = root
- while it
- len += 1
- it = it.link
- end
- it = root
- (len - k - 1).times {
- it = it.link
+ first = root
+ second = root
+ (k + 1).times {
+ second = second.link
}
- it.link = it.link.link
+ while second
+ first = first.link
+ second = second.link
+ end
+
+ first.link = first.link.link
end
display(root)
| Remove nth element single pass
|
diff --git a/lani.gemspec b/lani.gemspec
index abc1234..def5678 100644
--- a/lani.gemspec
+++ b/lani.gemspec
@@ -19,5 +19,7 @@ spec.require_paths = ["lib"]
spec.add_development_dependency "bundler", "~> 1.3"
+ spec.add_development_dependency "rexical"
+ spec.add_runtime_dependency "racc"
spec.add_development_dependency "rake"
end
| Add racc and rexical dependencies
|
diff --git a/lib/rack/contrib/common_cookies.rb b/lib/rack/contrib/common_cookies.rb
index abc1234..def5678 100644
--- a/lib/rack/contrib/common_cookies.rb
+++ b/lib/rack/contrib/common_cookies.rb
@@ -19,10 +19,8 @@ private
def domain
- @domain ||= begin
- @host =~ DOMAIN_REGEXP
- ".#{$1}.#{$2}"
- end
+ @host =~ DOMAIN_REGEXP
+ ".#{$1}.#{$2}"
end
def share_cookie(headers)
| Fix bug with domain caching for common cookies in production
|
diff --git a/config/initializers/pivotal_tracker.rb b/config/initializers/pivotal_tracker.rb
index abc1234..def5678 100644
--- a/config/initializers/pivotal_tracker.rb
+++ b/config/initializers/pivotal_tracker.rb
@@ -1,5 +1,5 @@ require 'pivotal-tracker'
-token = ENV['CI'] ? '' : ENV['PIVOTAL_TOKEN']
+token = ENV['CI'] ? 'vhTkprGx7CtvotWhwy9NzoWAmpzQisjA' : ENV['PIVOTAL_TOKEN']
raise 'No Environment variable PIVOTAL_TOKEN found' unless token
PivotalTracker::Client.token = token
| Fix error when using empty Pivotal token
|
diff --git a/lib/dox.rb b/lib/dox.rb
index abc1234..def5678 100644
--- a/lib/dox.rb
+++ b/lib/dox.rb
@@ -24,10 +24,6 @@ require 'dox/version'
module Dox
- class << self
- attr_writer :config
- end
-
def self.configure
yield(config) if block_given?
end
| Remove dispensable Dox.config= attr writer
|
diff --git a/app/policies/campaign_policy.rb b/app/policies/campaign_policy.rb
index abc1234..def5678 100644
--- a/app/policies/campaign_policy.rb
+++ b/app/policies/campaign_policy.rb
@@ -14,4 +14,8 @@ def toggle_membership?
user.present?
end
+
+ def new?
+ record.member?(user)
+ end
end
| Add policy for new campaign
|
diff --git a/app/uploaders/image_uploader.rb b/app/uploaders/image_uploader.rb
index abc1234..def5678 100644
--- a/app/uploaders/image_uploader.rb
+++ b/app/uploaders/image_uploader.rb
@@ -53,6 +53,6 @@ end
def calculate_md5
- Digest::MD5.hexdigest(model.image.read)
+ Digest::MD5.hexdigest(file.read)
end
end
| Fix a rare issue where setting of md5 fails. |
diff --git a/lib/memes.rb b/lib/memes.rb
index abc1234..def5678 100644
--- a/lib/memes.rb
+++ b/lib/memes.rb
@@ -1,28 +1,28 @@ class Memes
@memes = {
# "a wild ruby library appears"
- :pokemon => /a wild (.*) appears/,
+ :pokemon => /a wild (.*) appears/i,
# "I don't always write regexp but when I do they break"
- :dos_equis => /I don'?t always (.*) but when I do? (.*)/,
+ :dos_equis => /I don'?t always (.*) but when I do? (.*)/i,
# "North Korea is best Korea"
- :is_best => /(\w*\b) (\w*\b) is best (\w*\b)/,
+ :is_best => /(\w*\b) (\w*\b) is best (\w*\b)/i,
# Yo dawg I heard you like regexp so I put a regexp in your regexp so you can blah
- :yo_dawg => /yo dawg I hea?rd you like (.*) so I put a (.*) in your (.*) so you can (.*) while you (.*)/,
+ :yo_dawg => /yo dawg I hea?rd you like (.*) so I put a (.*) in your (.*) so you can (.*) while you (.*)/i,
# cant tell if this project is going to go anywhere or just end up on the bottom of my github profile
# not sure if blah or blah
- :fry => /(can'?t tell|not sure) if (.*) or (.*)/,
+ :fry => /(can'?t tell|not sure) if (.*) or (.*)/i,
# lets take all the memes and put them over here
- :patrick => /let'?s take all the (.*) and put them over here/,
+ :patrick => /let'?s take all the (.*) and put them over here/i,
# soon
- :soon => /soon/,
+ :soon => /soon/i,
# Y U NO?
- :y_u_no? => /(.*) Y U NO (.*)?/,
+ :y_u_no? => /(.*) Y U NO (.*)?/i,
}
end
| Make all the regexes case-insensitive.
|
diff --git a/lib/lurn/text/bernoulli_vectorizer.rb b/lib/lurn/text/bernoulli_vectorizer.rb
index abc1234..def5678 100644
--- a/lib/lurn/text/bernoulli_vectorizer.rb
+++ b/lib/lurn/text/bernoulli_vectorizer.rb
@@ -17,7 +17,7 @@ def fit(documents)
@vocabulary = []
tokenized_docs = tokenize_documents(documents)
- @vocabulary = tokenized_docs.flatten.uniq.sort
+ @vocabulary = tokenized_docs.flatten(1).uniq.sort
reduce_features(tokenized_docs)
end
| Handle ngram vocabularies in the bernoulli vectorizer
|
diff --git a/lib/multi_json/adapters/jr_jackson.rb b/lib/multi_json/adapters/jr_jackson.rb
index abc1234..def5678 100644
--- a/lib/multi_json/adapters/jr_jackson.rb
+++ b/lib/multi_json/adapters/jr_jackson.rb
@@ -8,8 +8,6 @@ ParseError = ::JrJackson::ParseError
def load(string, options={}) #:nodoc:
- # https://github.com/guyboertje/jrjackson/issues/20
- string = string.read if StringIO === string
::JrJackson::Json.load(string, options)
end
| Remove explicit stringio read call for JrJackson
The bug was fixed https://github.com/guyboertje/jrjackson/issues/20
Closes #147
|
diff --git a/lib/customer_domains.rb b/lib/customer_domains.rb
index abc1234..def5678 100644
--- a/lib/customer_domains.rb
+++ b/lib/customer_domains.rb
@@ -21,7 +21,7 @@ end
def logged_in_as_current_customer?
- current_customer && current_user && CustomerUser.linked?(current_customer, current_user)
+ current_customer && current_user && (CustomerUser.linked?(current_customer, current_user) || current_user.is_admin)
end
# before_filter :customer_login_required, checks for current_customer, current_user and a link between the two
| Allow a site admin to see customers' data
|
diff --git a/lib/buzzerbeater/api.rb b/lib/buzzerbeater/api.rb
index abc1234..def5678 100644
--- a/lib/buzzerbeater/api.rb
+++ b/lib/buzzerbeater/api.rb
@@ -10,18 +10,33 @@ base_uri 'bbapi.buzzerbeater.com'
format :xml
+ # @!attribute session_id
+ # @return [String] the session ID used by this API object
+ attr_accessor :session_id
+
+ # @!attribute auth_token
+ # @return [String] the authentication token for this session
+ attr_accessor :auth_token
+
+
# Create a new API object.
#
+ # When creating a new API object as entry point for accessing the API a session ID and authentication
+ # token can be provided if already retrieved during a former login.
+ #
# @example
- # api = Buzzerbeater::API.new('username', 'access_key')
+ # api = Buzzerbeater::API.new
+ # api = Buzzerbeater::API.new('session_id', 'auth_token')
#
- # @param [String] username the username
- # @param [String] access_key the user's access key
+ # @see Buzzerbeater::API#login
+ #
+ # @param [String] session_id the session ID retrieved from the API after performing a login (optional)
+ # @param [String] auth_token the authentication token returned by the login method (optional)
#
# @return [Buzzerbeater::API] the API object.
- def initialize(username, access_key)
- @username, @access_key = username, access_key
+ def initialize(session_id, auth_token)
+ @session_id, @auth_token = session_id, auth_token
end
end | Correct constructor and instance variables for API
|
diff --git a/spec/classes/relationship__titles_spec.rb b/spec/classes/relationship__titles_spec.rb
index abc1234..def5678 100644
--- a/spec/classes/relationship__titles_spec.rb
+++ b/spec/classes/relationship__titles_spec.rb
@@ -8,6 +8,7 @@
it { should contain_file('/etc/svc') }
it { should contain_service('svc-title') }
+ it { should contain_service('svc-name') }
it { should contain_file('/etc/svc').that_notifies('Service[svc-name]') }
it { should contain_file('/etc/svc').that_comes_before('Service[svc-name]') }
| Add spec that tests if resources can be found by their namevar as well as title
|
diff --git a/spec/controllers/pages_controller_spec.rb b/spec/controllers/pages_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/pages_controller_spec.rb
+++ b/spec/controllers/pages_controller_spec.rb
@@ -0,0 +1,14 @@+require 'spec_helper'
+
+describe HighVoltage::PagesController, '#show' do
+ %w(about).each do |page|
+ context 'on GET to /p/#{page}' do
+ before do
+ get :show, :id => page
+ end
+
+ it { should respond_with(:success) }
+ it { should render_template(page) }
+ end
+ end
+end
| Add a spec for the pages controller
|
diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/users_controller_spec.rb
+++ b/spec/controllers/users_controller_spec.rb
@@ -0,0 +1,33 @@+# Copyright (c) 2010, Diaspora Inc. This file is
+# licensed under the Affero General Public License version 3. See
+# the COPYRIGHT file.
+
+require 'spec_helper'
+
+describe UsersController do
+ before do
+ @user = Factory.create(:user)
+ sign_in :user, @user
+ @user.aspect(:name => "lame-os")
+ end
+
+ describe '#update' do
+ context 'with a profile photo set' do
+ before do
+ @user.person.profile.image_url = "http://tom.joindiaspora.com/images/user/tom.jpg"
+ @user.person.profile.save
+ end
+
+ it "doesn't overwrite the profile photo when an empty string is passed in" do
+ image_url = @user.person.profile.image_url
+ put("update", :id => @user.id, "user"=> {"profile"=>
+ {"image_url" => "",
+ "last_name" => @user.person.profile.last_name,
+ "first_name" => @user.person.profile.first_name}})
+
+ @user.person.profile.image_url.should == image_url
+ end
+
+ end
+ end
+end
| Add spec for not overwriting the image_url on profile update
|
diff --git a/spec/unit/converters/convert_file_spec.rb b/spec/unit/converters/convert_file_spec.rb
index abc1234..def5678 100644
--- a/spec/unit/converters/convert_file_spec.rb
+++ b/spec/unit/converters/convert_file_spec.rb
@@ -7,8 +7,9 @@ prompt.input << "test.txt"
prompt.input.rewind
+ allow(::File).to receive(:dirname).and_return('.')
+ allow(::File).to receive(:join).and_return("test\.txt")
allow(::File).to receive(:open).with(/test\.txt/).and_return(file)
- expect(::File).to receive(:open).with(/test\.txt/)
answer = prompt.ask("Which file to open?", convert: :file)
| Change to stub all dependent constants
|
diff --git a/lib/feed2email/email.rb b/lib/feed2email/email.rb
index abc1234..def5678 100644
--- a/lib/feed2email/email.rb
+++ b/lib/feed2email/email.rb
@@ -1,5 +1,6 @@ require 'mail'
require 'feed2email/core_ext'
+require 'feed2email/version'
module Feed2Email
class Email
| Add missing require for Feed2Email::VERSION
|
diff --git a/lib/happy/controller.rb b/lib/happy/controller.rb
index abc1234..def5678 100644
--- a/lib/happy/controller.rb
+++ b/lib/happy/controller.rb
@@ -14,7 +14,7 @@ :render, :url_for,
:to => :context
- def initialize(env = nil, options = {}, &blk)
+ def initialize(env = {}, options = {}, &blk)
@env = env
@options = options
instance_exec(&blk) if blk
| Initialize Controller with a default @env of {} |
diff --git a/lib/model/prices_url.rb b/lib/model/prices_url.rb
index abc1234..def5678 100644
--- a/lib/model/prices_url.rb
+++ b/lib/model/prices_url.rb
@@ -13,4 +13,4 @@
class InvalidURL < StandardError
end
-end+end
| Add newline at end of file
|
diff --git a/lib/shoulda/whenever.rb b/lib/shoulda/whenever.rb
index abc1234..def5678 100644
--- a/lib/shoulda/whenever.rb
+++ b/lib/shoulda/whenever.rb
@@ -1,3 +1,4 @@+require "shoulda/whenever/version"
require "shoulda/whenever/schedule_matcher"
module Shoulda
| Include the version this time.
|
diff --git a/lib/storext/override.rb b/lib/storext/override.rb
index abc1234..def5678 100644
--- a/lib/storext/override.rb
+++ b/lib/storext/override.rb
@@ -18,7 +18,7 @@ storext_definitions = association_class.storext_definitions
storext_definitions.each do |attr, attr_definition|
if attr_definition[:column] == column_name
- storext_overrider_define_reader(
+ storext_overrider_accessor(
association_name,
column_name,
attr,
@@ -36,7 +36,7 @@ end
end
- def storext_overrider_define_reader(association_name, column_name, attr, attr_definition)
+ def storext_overrider_accessor(association_name, column_name, attr, attr_definition)
self.store_attribute(
column_name,
attr,
| Rename method to be more descriptive
|
diff --git a/lib/cli.rb b/lib/cli.rb
index abc1234..def5678 100644
--- a/lib/cli.rb
+++ b/lib/cli.rb
@@ -4,9 +4,14 @@
class Cli < Thor
- desc "hello", "say hello"
+ desc "hello", "Say hello"
def hello
puts "Well, I met a girl called Sandoz\nAnd she taught me many, many things\nGood things, very good things, sweet things."
+ end
+
+ desc "new", "Take a hit and create a new sandoz project"
+ def new
+ `say Well, I met a girl called Sandoz`
end
end
| Add a playful 'new' command.
|
diff --git a/config/initializers/garner.rb b/config/initializers/garner.rb
index abc1234..def5678 100644
--- a/config/initializers/garner.rb
+++ b/config/initializers/garner.rb
@@ -1,8 +1,52 @@ require "garner"
require "garner/mixins/mongoid"
+require "garner/mixins/rack"
module Mongoid
module Document
include Garner::Mixins::Mongoid::Document
end
+end
+
+# Monkey patch to cache headers until this is built into Garner
+# https://github.com/artsy/garner/issues/54
+module Garner
+ module Cache
+ class Identity
+ TRACKED_HEADERS = %w{ Link X-Total-Count X-Total-Pages X-Current-Page X-Next-Page X-Previous-Page }
+
+ alias_method :_fetch, :fetch
+ def fetch(&block)
+ if @key_hash[:tracked_grape_headers]
+ result, headers = _fetch do
+ result = yield
+ headers = @ruby_context.header.slice(*TRACKED_HEADERS) if @ruby_context.respond_to?(:header)
+ [result, headers]
+ end
+
+ (headers || {}).each do |key, value|
+ @ruby_context.header(key, value) if @ruby_context.respond_to?(:header)
+ end
+
+ result
+ else
+ _fetch(&block)
+ end
+ end
+
+ end
+ end
+end
+
+module Garner
+ module Mixins
+ module Rack
+
+ alias_method :_garner, :garner
+ def garner(&block)
+ response, headers = _garner.key({ tracked_grape_headers: true }, &block)
+ end
+
+ end
+ end
end | Allow headers to be cached along with the response
Garner doesn't support this out of the box. I applied this monkey patch:
https://github.com/artsy/garner/issues/54
|
diff --git a/install.rb b/install.rb
index abc1234..def5678 100644
--- a/install.rb
+++ b/install.rb
@@ -2,4 +2,6 @@
s3_config = File.dirname(__FILE__) + '/../../../config/amazon_s3.yml'
FileUtils.cp File.dirname(__FILE__) + '/amazon_s3.yml.tpl', s3_config unless File.exist?(s3_config)
+cloudfiles_config = File.dirname(__FILE__) + '/../../../config/rackspace_cloudfiles.yml'
+FileUtils.cp File.dirname(__FILE__) + '/rackspace_cloudfiles.yml.tpl', cloudfiles_config unless File.exist?(cloudfiles_config)
puts IO.read(File.join(File.dirname(__FILE__), 'README')) | Install the rackspace_cloudfiles.yml template if it doesn't exist.
|
diff --git a/app/drops/yoolk/liquid/instant_website/pages_drop.rb b/app/drops/yoolk/liquid/instant_website/pages_drop.rb
index abc1234..def5678 100644
--- a/app/drops/yoolk/liquid/instant_website/pages_drop.rb
+++ b/app/drops/yoolk/liquid/instant_website/pages_drop.rb
@@ -1,19 +1,25 @@ module Yoolk
module Liquid
class InstantWebsite::PagesDrop < ::Liquid::Rails::CollectionDrop
+
def primary
- @primary ||= self.class.new(objects.take(6))
+ @primary ||= viewable_pages.take(6)
end
def more
- @more ||= self.class.new(objects.drop(6))
+ @more ||= viewable_pages.drop(6)
end
def more?
- more.select do |m|
- m.context = @context
- m.show?
- end.present?
+ more.present?
+ end
+
+ private
+ def viewable_pages
+ self.class.new(objects).select do |page|
+ page.context = @context
+ page.show?
+ end
end
end
end
| enh(pages): Hide menu MORE if instant website pages is less than 6 items
close #88
|
diff --git a/app/controllers/questions_controller.rb b/app/controllers/questions_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/questions_controller.rb
+++ b/app/controllers/questions_controller.rb
@@ -29,5 +29,6 @@ @question = Question.find_by(id: params[:id])
@question.update_attributes(view_count: (@question.view_count + 1))
@answer = Answer.new
+ @vote = Vote.new
end
end | Add vote object to show action on questions controller
|
diff --git a/numbers.rb b/numbers.rb
index abc1234..def5678 100644
--- a/numbers.rb
+++ b/numbers.rb
@@ -2,7 +2,7 @@ Succ = -> number { Cons[False][number] }
Pred = -> number { Cdr[number] }
-$zero = Cons[True][True]
+$zero = Cons[True][Noop]
$one = Succ[$zero]
$two = Succ[$one]
$three = Succ[$two]
| Switch $zero's value to Noop, rather than True
|
diff --git a/chatops_deployer.gemspec b/chatops_deployer.gemspec
index abc1234..def5678 100644
--- a/chatops_deployer.gemspec
+++ b/chatops_deployer.gemspec
@@ -11,7 +11,7 @@
spec.summary = %q{An opinionated Chatops backend}
spec.description = %q{ChatopsDeployer deploys containerized services in isolated VMs and exposes public facing URLs}
- spec.homepage = "https://github.com/code-mancers/chatops-deployer"
+ spec.homepage = "https://github.com/code-mancers/chatops_deployer"
spec.license = "MIT"
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
| Fix homepage link in gemspec
"chatops-deployer" with a hyphen gets redirected to https://github.com/code-mancers/flynn-deployer |
diff --git a/mail.gemspec b/mail.gemspec
index abc1234..def5678 100644
--- a/mail.gemspec
+++ b/mail.gemspec
@@ -16,7 +16,8 @@ s.add_dependency('activesupport', ">= 2.3.6")
s.add_dependency('mime-types', "~> 1.16")
s.add_dependency('treetop', '~> 1.4.8')
- s.add_dependency('i18n', '>= 0.4.1')
+ s.add_dependency('i18n', '~> 0.4.1')
+ s.add_dependency('tlsmail', '~> 0.0.1') if RUBY_VERSION == '1.8.6'
s.require_path = 'lib'
s.files = %w(README.rdoc Rakefile TODO.rdoc) + Dir.glob("lib/**/*")
| Fix merge conflict in gemspec
|
diff --git a/config/initializers/new_framework_defaults.rb b/config/initializers/new_framework_defaults.rb
index abc1234..def5678 100644
--- a/config/initializers/new_framework_defaults.rb
+++ b/config/initializers/new_framework_defaults.rb
@@ -14,7 +14,7 @@
# Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`.
# Previous versions had false.
-ActiveSupport.to_time_preserves_timezone = false
+ActiveSupport.to_time_preserves_timezone = true
# Require `belongs_to` associations by default. Previous versions had false.
Rails.application.config.active_record.belongs_to_required_by_default = false
| Set ActiveSupport.to_time_preserves_timezone to 'true' because we use Ruby 2.4.0
|
diff --git a/config/initializers/new_framework_defaults.rb b/config/initializers/new_framework_defaults.rb
index abc1234..def5678 100644
--- a/config/initializers/new_framework_defaults.rb
+++ b/config/initializers/new_framework_defaults.rb
@@ -15,6 +15,3 @@ # Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`.
# Previous versions had false.
ActiveSupport.to_time_preserves_timezone = false
-
-# Require `belongs_to` associations by default. Previous versions had false.
-# Rails.application.config.active_record.belongs_to_required_by_default = false
| Remove existing option that's been commented out
|
diff --git a/Library/Homebrew/test/test_hardware.rb b/Library/Homebrew/test/test_hardware.rb
index abc1234..def5678 100644
--- a/Library/Homebrew/test/test_hardware.rb
+++ b/Library/Homebrew/test/test_hardware.rb
@@ -10,7 +10,8 @@
def test_hardware_intel_family
if Hardware.cpu_type == :intel
- assert [:core, :core2, :penryn, :nehalem, :arrandale, :sandybridge].include?(Hardware.intel_family)
+ assert [:core, :core2, :penryn, :nehalem,
+ :arrandale, :sandybridge, :ivybridge].include?(Hardware.intel_family)
end
end
end
| Fix test failure on ivybridge cpus.
Closes #18371.
Signed-off-by: Adam Vandenberg <34c2b6407fd5a10249a15d699d40f9ed1782e98c@gmail.com>
|
diff --git a/lib/carto/gcloud_user_settings.rb b/lib/carto/gcloud_user_settings.rb
index abc1234..def5678 100644
--- a/lib/carto/gcloud_user_settings.rb
+++ b/lib/carto/gcloud_user_settings.rb
@@ -7,8 +7,9 @@ gcp_execution_project bq_project bq_dataset
gcs_bucket).freeze
- def initialize(username)
+ def initialize(username, redis = $users_metadata)
@username = username
+ @redis = redis
end
def update(attributes)
@@ -20,13 +21,13 @@ end
def read
- Hash[REDIS_KEYS.zip($users_metadata.hmget(key, *REDIS_KEYS))]
+ Hash[REDIS_KEYS.zip(@redis.hmget(key, *REDIS_KEYS))]
end
private
def store(attributes)
- $users_metadata.hmset(key, *values(attributes).to_a)
+ @redis.hmset(key, *values(attributes).to_a)
end
def values(attributes)
@@ -34,7 +35,7 @@ end
def remove
- $users_metadata.del(key)
+ @redis.del(key)
end
def key
| Add ability to inject a redis connection
|
diff --git a/lib/quickbooks/service/reports.rb b/lib/quickbooks/service/reports.rb
index abc1234..def5678 100644
--- a/lib/quickbooks/service/reports.rb
+++ b/lib/quickbooks/service/reports.rb
@@ -2,27 +2,37 @@ module Service
class Reports < BaseService
- def url_for_query(which_report = 'BalanceSheet', date_macro = 'This Fiscal Year-to-date')
- "#{url_for_base}/reports/#{which_report}?date_macro=#{URI.encode_www_form_component(date_macro)}"
+ def url_for_query(which_report = 'BalanceSheet', date_macro = 'This Fiscal Year-to-date', options = {})
+ if(options == {})
+ return "#{url_for_base}/reports/#{which_report}?date_macro=#{URI.encode_www_form_component(date_macro)}"
+ else
+ options.each do |key, value|
+ options_string += "#{key}=#{value}&"
+ end
+ options_string = options_string[0..-2]
+ options_string.gsub!(/\s/,"%20")
+ # finalURL = "#{url_for_resource(model::REST_RESOURCE)}/#{report_name}#{options_string}"
+ return "#{url_for_base}/reports/#{which_report}?date_macro=#{URI.encode_www_form_component(date_macro)}&#{options_string}"
+ end
end
- def fetch_collection(model, date_macro, object_query)
- response = do_http_get(url_for_query(object_query, date_macro))
+ def fetch_collection(model, date_macro, object_query, options)
+ response = do_http_get(url_for_query(object_query, date_macro, options))
parse_collection(response, model)
end
- def query(object_query = 'BalanceSheet', date_macro = 'This Fiscal Year-to-date')
+ def query(object_query = 'BalanceSheet', date_macro = 'This Fiscal Year-to-date', options = {})
fetch_collection(model, date_macro , object_query)
end
private
-
+
def model
Quickbooks::Model::Reports
end
end
end
-end+end
| Add options parsing for richer report gathering |
diff --git a/lib/secretary/dirty/attributes.rb b/lib/secretary/dirty/attributes.rb
index abc1234..def5678 100644
--- a/lib/secretary/dirty/attributes.rb
+++ b/lib/secretary/dirty/attributes.rb
@@ -26,6 +26,15 @@ end
+ if ActiveRecord::VERSION::STRING < "4.1.0"
+ def reload(*)
+ result = super
+ clear_custom_changes
+ result
+ end
+ end
+
+
private
if ActiveRecord::VERSION::STRING >= "4.1.0"
@@ -38,13 +47,6 @@ super
clear_custom_changes
end
-
- else
- def reload(*)
- super.tap do
- clear_custom_changes
- end
- end
end
| Move reload into public API
|
diff --git a/envs/shell/lib/taskers/tasker/shell.rb b/envs/shell/lib/taskers/tasker/shell.rb
index abc1234..def5678 100644
--- a/envs/shell/lib/taskers/tasker/shell.rb
+++ b/envs/shell/lib/taskers/tasker/shell.rb
@@ -1,7 +1,8 @@
class ShellTasker < Flor::BasicTasker
- NATO = %w[ alpha bravo charly delta echo fox foxtrott golf echo hotel ]
+ NATO = %w[ alpha bravo charly delta fox foxtrott golf echo hotel ]
+ # there is no "echo" here, since there is an "echo" procedure
def task
| Remove "echo" from flosh pre-NatoTasker routing
|
diff --git a/app/helpers/form_helper.rb b/app/helpers/form_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/form_helper.rb
+++ b/app/helpers/form_helper.rb
@@ -3,8 +3,8 @@ ops = {}
if admin_in_read_only_mode? || (submission && !current_user.account_admin?)
- ops[:disabled] = 'disabled'
- ops[:class] = 'read-only'
+ ops[:disabled] = "disabled"
+ ops[:class] = "read-only"
end
ops
| Use double quotes instead of singles
|
diff --git a/app/models/raw_time_row.rb b/app/models/raw_time_row.rb
index abc1234..def5678 100644
--- a/app/models/raw_time_row.rb
+++ b/app/models/raw_time_row.rb
@@ -4,7 +4,7 @@ include ActiveModel::Serializers::JSON
RAW_TIME_ATTRIBUTES = [:id, :absolute_time, :entered_time, :bib_number, :split_name, :sub_split_kind, :data_status,
- :split_time_exists, :lap, :stopped_here, :with_pacer, :source, :remarks]
+ :split_time_exists, :entered_lap, :stopped_here, :with_pacer, :source, :remarks]
RAW_TIME_METHODS = [:military_time, :sub_split_kind]
def serialize
| Add entered_lap to Raw Time Row serializer
|
diff --git a/app/models/store_mailer.rb b/app/models/store_mailer.rb
index abc1234..def5678 100644
--- a/app/models/store_mailer.rb
+++ b/app/models/store_mailer.rb
@@ -25,7 +25,7 @@ subject = "#{APP_CONFIG['email_subject_prefix']} #{t("stizun.store_mailer.order_confirmation_subject")}"
mail(:to => order.notification_email_addresses,
- :bcc => @from,
+ :cc => @from,
:subject => subject) do |format|
format.text { render StoreMailer.template_path("order_confirmation") }
end
@@ -36,7 +36,7 @@ subject = "#{APP_CONFIG['email_subject_prefix']} #{t("stizun.store_mailer.invoice_notification_subject")}"
@invoice = invoice
mail(:to => invoice.notification_email_addresses,
- :bcc => @from,
+ :cc => @from,
:subject => subject) do |format|
| Store mailer mails CC to from address instead of bcc.
|
diff --git a/files/graylog-ctl-commands/disable_mongodb.rb b/files/graylog-ctl-commands/disable_mongodb.rb
index abc1234..def5678 100644
--- a/files/graylog-ctl-commands/disable_mongodb.rb
+++ b/files/graylog-ctl-commands/disable_mongodb.rb
@@ -0,0 +1,28 @@+add_command 'disable-mongodb', 'Disable MongoDB on this node', 1 do |cmd_name|
+ require 'fileutils'
+ require 'json'
+
+ if true
+ existing_services ||= Hash.new
+ if File.exists?("/etc/graylog/graylog-services.json")
+ existing_services = JSON.parse(File.read("/etc/graylog/graylog-services.json"))
+ else
+ FileUtils.mkdir_p("/etc/graylog")
+ existing_services['etcd'] = Hash.new
+ existing_services['nginx'] = Hash.new
+ existing_services['mongodb'] = Hash.new
+ existing_services['elasticsearch'] = Hash.new
+ existing_services['graylog_server'] = Hash.new
+ end
+
+ existing_services['mongodb']['enabled'] = false
+
+ File.open("/etc/graylog/graylog-services.json","w") do |services|
+ services.write(JSON.pretty_generate(existing_services))
+ end
+
+ reconfigure
+ else
+ puts "Usage: #{cmd_name}"
+ end
+end
| Add Disable MongoDB Command to graylog-ctl
|
diff --git a/opsworks-deploy.gemspec b/opsworks-deploy.gemspec
index abc1234..def5678 100644
--- a/opsworks-deploy.gemspec
+++ b/opsworks-deploy.gemspec
@@ -24,6 +24,5 @@ spec.add_development_dependency "bundler", "~> 1.3"
spec.add_development_dependency "rake"
spec.add_development_dependency "rspec"
- spec.add_development_dependency "json"
spec.add_development_dependency 'aws-sdk'
end
| Remove second dependency on json
|
diff --git a/lib/gooru.rb b/lib/gooru.rb
index abc1234..def5678 100644
--- a/lib/gooru.rb
+++ b/lib/gooru.rb
@@ -1,5 +1,3 @@-ENV["GOORU_URL"] ||= "http://concept.goorulearning.org/"
-
require "stringio"
require "weary"
| Allow users of the gem to set GOORU_URL.
|
diff --git a/libcard.rb b/libcard.rb
index abc1234..def5678 100644
--- a/libcard.rb
+++ b/libcard.rb
@@ -8,9 +8,8 @@ owen = Account.new('4356489X','19041972','owen.patel@gmail.com',warks)
get '/go-go-owen-renew' do
-# owen.getCurrentloans
+ owen.getCurrentloans
# owen.renewLoans
# owen.getCurrentloans
-# "#{owen.currentloans.to_s}"
- "done"
+ "#{owen.currentloans.to_s}"
end | Call to current loans added back in - moment of truth
|
diff --git a/nori.gemspec b/nori.gemspec
index abc1234..def5678 100644
--- a/nori.gemspec
+++ b/nori.gemspec
@@ -17,6 +17,7 @@ s.add_development_dependency "rake", "~> 10.0"
s.add_development_dependency "nokogiri", ">= 1.4.0"
s.add_development_dependency "rspec", "~> 2.12"
+ s.add_development_dependency "transpec"
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
| Add transpec as a dev dependency
|
diff --git a/core/app/models/spree/base.rb b/core/app/models/spree/base.rb
index abc1234..def5678 100644
--- a/core/app/models/spree/base.rb
+++ b/core/app/models/spree/base.rb
@@ -4,10 +4,19 @@
include Spree::RansackableAttributes
- after_initialize do
+ def initialize_preference_defaults
if has_attribute?(:preferences)
self.preferences = default_preferences.merge(preferences)
end
+ end
+
+ # Only run preference initialization on models which requires it. Improves
+ # performance of record initialization slightly.
+ def self.preference(*args)
+ # after_initialize can be called multiple times with the same symbol, it
+ # will only be called once on initialization.
+ after_initialize :initialize_preference_defaults
+ super
end
if Kaminari.config.page_method_name != :page
| Optimize init on models without preferences
This hook was run on initialization of every model (after_initialize is
run both on .new, .find, etc), but is only necessary on models which
have preferences. The hook is fairly quick, breaking out immediately
after checking has_attribute?, but object initialization is so common an
operation we should avoid any work we can.
Benchmark.ips do |x|
x.report("building") do
Spree::InventoryUnit.new
end
x.report("building and accessing") do
Spree::InventoryUnit.new.state
end
end
Before:
building 16.692k (± 4.2%) i/s - 84.392k
building and accessing
15.554k (± 3.4%) i/s - 78.540k
After:
building 19.819k (± 3.8%) i/s - 99.921k
building and accessing
19.465k (± 3.9%) i/s - 97.384k
|
diff --git a/textext-rails.gemspec b/textext-rails.gemspec
index abc1234..def5678 100644
--- a/textext-rails.gemspec
+++ b/textext-rails.gemspec
@@ -8,8 +8,8 @@ s.authors = ["Jeff Pollard"]
s.email = ["jeff.pollard@gmail.com"]
s.homepage = ""
- s.summary = %q{TODO: Write a gem summary}
- s.description = %q{TODO: Write a gem description}
+ s.summary = %q{Adds the jQuery TextExt plugin to the Rails 3.1 asset pipeline}
+ s.description = %q{Adds the jQuery TextExt plugin to the Rails 3.1 asset pipeline}
s.rubyforge_project = "textext-rails"
| Add gem description to the gemspec readme.
|
diff --git a/app/controllers/articles_controller.rb b/app/controllers/articles_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/articles_controller.rb
+++ b/app/controllers/articles_controller.rb
@@ -1,4 +1,6 @@ class ArticlesController < ApplicationController
+
+ before_filter :authenticate_user!
def index
@articles = Article.all
| Add user authentification on controller 'articles'
|
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -32,7 +32,7 @@ if params[:setup]
Backend.build(@project)
elsif params[:hipchat_room]
- Backend.fire_worker "circle.backend.build.email/send-hipchat-setup-notification", @project.id.to_s
+ Backend.fire_worker "circle.backend.build.notify/send-hipchat-setup-notification", @project.id.to_s
end
respond_with @project do |f|
| Use the correct clojure function to notify about the hipchat plugin.
|
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
@@ -9,11 +9,16 @@
def create
service = Service.initialize_from_omniauth( omniauth_hash )
+ service.user = current_user
- if current_user.services << service
+ if service.save
flash[:success] = t('flash.service.create.success')
else
- flash[:error] = t('flash.service.create.error')
+ if service.errors.details.has_key?(:uid) && service.errors.details[:uid].any? { |err| err[:error] == :taken }
+ flash[:error] = "The #{service.type.split('::').last.titleize} account you are trying to connect is already connected to another #{APP_CONFIG['site_name']} account."
+ else
+ flash[:error] = t('flash.service.create.error')
+ end
end
if origin
| Improve error messaging when trying to attach a service connected to another account
|
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
@@ -7,18 +7,16 @@ user = User.find_by(name: session_params[:name])
if user && user.authenticate(session_params[:password])
session[:user_id] = user.id
- # hardcoding '/' for now so that I don't have to go into config/routes.rb before getting approval from team
redirect_to '/'
else
flash.now[:error] = "Your login information was incorrect"
- # hard-coded for now! Will replace with rails helper
- redirect_to '/session/new'
+ redirect_to root_path
end
end
def destroy
- # set session id to nil
- #redirect to homepage
+ session.clear
+ redirect_to root_path
end
def session_params
| Refactor routes with rails helper url methods
Use root_path in #create and #destroy actions in sessions controller
|
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
@@ -17,7 +17,7 @@
def destroy
session.clear
- redirect_to login_path
+ redirect_to '/'
end
private
| Change logout redirect to homepage
|
diff --git a/app/controllers/snippets_controller.rb b/app/controllers/snippets_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/snippets_controller.rb
+++ b/app/controllers/snippets_controller.rb
@@ -22,7 +22,7 @@
def update
@snippet = Snippet.find(params["id"])
- if @snippet.update(content: params["snippet"]["content"], flagged: params["snippet"]["flagged"])
+ if @snippet.update(content: params["snippet"]["content"])
if request.xhr?
render plain: "Autosaved on " + @snippet.updated_at.strftime("%m/%d/%Y at %I:%M:%S %p")
else
| Remove flagged params from snippet
|
diff --git a/app/controllers/tutorial_controller.rb b/app/controllers/tutorial_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/tutorial_controller.rb
+++ b/app/controllers/tutorial_controller.rb
@@ -23,8 +23,14 @@ end
def viewDidLoad
- @one_button.when(UIControlEventTouchUpInside) {@sound1.play}
- @two_button.when(UIControlEventTouchUpInside) {@sound2.play}
+ @one_button.when(UIControlEventTouchUpInside) do
+ @sound2.stop if @sound2.is_playing?
+ @sound1.play
+ end
+ @two_button.when(UIControlEventTouchUpInside) do
+ @sound1.stop if @sound1.is_playing?
+ @sound2.play
+ end
@start_button.when(UIControlEventTouchUpInside) do
if @type == :miller_and_heise
start_miller_and_heise_test
| Stop other sound from playing in tutorial
|
diff --git a/activerecord/test/models/cat.rb b/activerecord/test/models/cat.rb
index abc1234..def5678 100644
--- a/activerecord/test/models/cat.rb
+++ b/activerecord/test/models/cat.rb
@@ -2,9 +2,6 @@ self.abstract_class = true
enum gender: [:female, :male]
-
- scope :female, -> { where(gender: genders[:female]) }
- scope :male, -> { where(gender: genders[:male]) }
default_scope -> { where(is_vegetarian: false) }
end
| Fix `warning: method redefined; discarding old female`
```
$ ARCONN=mysql2 be ruby -w -Itest test/cases/scoping/default_scoping_test.rb
Using mysql2
/Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/scoping/named.rb:158: warning: method redefined; discarding old female
/Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/scoping/named.rb:158: warning: previous definition of female was here
/Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/scoping/named.rb:158: warning: method redefined; discarding old male
/Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/scoping/named.rb:158: warning: previous definition of male was here
```
|
diff --git a/nubis/tests/spec/services_spec.rb b/nubis/tests/spec/services_spec.rb
index abc1234..def5678 100644
--- a/nubis/tests/spec/services_spec.rb
+++ b/nubis/tests/spec/services_spec.rb
@@ -5,7 +5,15 @@ it { should_not be_enabled }
end
+describe service('node_exporter') do
+ it { should_not be_enabled }
+end
+
# These should be enabled
+describe service('sshd') do
+ it { should be_enabled }
+end
+
describe service('confd') do
it { should be_enabled }
end
| Add 2 more service tests
- sshd enabled
- node_exporter disabled (enabled by confd)
|
diff --git a/lib/bmff/box.rb b/lib/bmff/box.rb
index abc1234..def5678 100644
--- a/lib/bmff/box.rb
+++ b/lib/bmff/box.rb
@@ -15,6 +15,7 @@ require "bmff/box/progressive_download_info"
require "bmff/box/movie"
require "bmff/box/movie_header"
+require "bmff/box/track"
module BMFF::Box
def self.get_box(io, parent)
| Add "require" for the Track Box class.
|
diff --git a/test/mobile/features/steps/unity_steps.rb b/test/mobile/features/steps/unity_steps.rb
index abc1234..def5678 100644
--- a/test/mobile/features/steps/unity_steps.rb
+++ b/test/mobile/features/steps/unity_steps.rb
@@ -10,31 +10,38 @@ end
When("I tap the {string} button") do |button|
- # TODO: Better screen res support. Uses 1920 by default, or 2160 for ANDROID_9_0 device (Google Pixel 3)
- middle = 1920 / 2
- if Maze.config.device == "ANDROID_9_0"
- middle = 2160 / 2
- end
+ viewport = Maze.driver.session_capabilities['viewportRect']
+ width = viewport['left'] + viewport['width']
+ height = viewport['top'] + viewport['height']
+
+ STDOUT.puts "width: #{width}"
+ STDOUT.puts "height: #{height}"
+
+ center = width / 2
+
case button
when "throw Exception"
- press_at 540, middle - 750
+ press_at center, height - 750
when "Assertion failure"
- press_at 540, middle - 650
+ press_at center, height - 650
when "Native exception"
- press_at 540, middle - 550
+ press_at center, height - 550
when "Log caught exception"
- press_at 540, middle - 450
+ press_at center, height - 450
when "Log with class prefix"
- press_at 540, middle - 350
+ press_at center, height - 350
when "Notify caught exception"
- press_at 540, middle - 250
+ press_at center, height - 250
when "Notify with callback"
- press_at 540, middle - 150
+ press_at center, height - 150
+ when "Change scene"
+ press_at center, height - 50
end
end
def press_at(x, y)
- STDOUT.puts "tap #{x}. #{y}"
+ STDOUT.puts "tap: #{x},#{y}"
+
touch_action = Appium::TouchAction.new
touch_action.tap({:x => x, :y => y})
touch_action.perform
| Use Appium to determine screen dimensions |
diff --git a/VOKMockUrlProtocol.podspec b/VOKMockUrlProtocol.podspec
index abc1234..def5678 100644
--- a/VOKMockUrlProtocol.podspec
+++ b/VOKMockUrlProtocol.podspec
@@ -1,6 +1,6 @@ Pod::Spec.new do |s|
s.name = "VOKMockUrlProtocol"
- s.version = "2.0.1"
+ s.version = "2.0.2"
s.summary = "A url protocol that parses and returns fake responses with mock data."
s.homepage = "https://github.com/vokal/VOKMockUrlProtocol"
s.license = { :type => "MIT", :file => "LICENSE"}
@@ -12,5 +12,5 @@
s.source_files = 'VOKMockUrlProtocol.[hm]'
s.dependency 'ILGHttpConstants', '~> 1.0.0'
- s.dependency 'VOKBenkode', '~> 0.1.2'
+ s.dependency 'VOKBenkode', '~> 0.2.1'
end
| Update podspec dependency for VOKBenkode and verison bump
|
diff --git a/core/db/migrate/20131118183431_add_line_item_id_to_spree_inventory_units.rb b/core/db/migrate/20131118183431_add_line_item_id_to_spree_inventory_units.rb
index abc1234..def5678 100644
--- a/core/db/migrate/20131118183431_add_line_item_id_to_spree_inventory_units.rb
+++ b/core/db/migrate/20131118183431_add_line_item_id_to_spree_inventory_units.rb
@@ -5,10 +5,12 @@ add_column :spree_inventory_units, :line_item_id, :integer
add_index :spree_inventory_units, :line_item_id
- Spree::Shipment.includes(:inventory_units, :order).find_each do |shipment|
- shipment.inventory_units.group_by(&:variant).each do |variant, units|
+ shipments = Spree::Shipment.includes(:inventory_units, :order)
- line_item = shipment.order.find_line_item_by_variant(variant)
+ shipments.find_each do |shipment|
+ shipment.inventory_units.group_by(&:variant_id).each do |variant, units|
+
+ line_item = shipment.order.line_items.find_by(variant_id: variant_id)
next unless line_item
Spree::InventoryUnit.where(id: units.map(&:id)).update_all(line_item_id: line_item.id)
| Make migration more tolerant of deleted Variants
This migration bailed for me when it found an old order (before Spree used `acts_as_paranoid`) with a line_item referencing a Variant that no longer existed.
Making the migration use `variant_id` instead of `variant.id` fixed this problem for me, and I suspect will make the migration path smoother for other people who have been using Spree since before the `paranoia` gem.
Fixes #4822
|
diff --git a/app/controllers/questions_controller.rb b/app/controllers/questions_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/questions_controller.rb
+++ b/app/controllers/questions_controller.rb
@@ -1,7 +1,9 @@ get '/questions/new' do
- binding.pry
@survey = Survey.find_by(id: params[:survey_id])
erb :"/questions/new"
end
-# NEXT STEP: ADD Questions Post Route
+post '/questions' do
+ binding.pry
+
+end
| Implement separation of created and available surveys on surveys/index
|
diff --git a/app/controllers/activity_controller.rb b/app/controllers/activity_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/activity_controller.rb
+++ b/app/controllers/activity_controller.rb
@@ -0,0 +1,26 @@+class ActivityController < ApplicationController
+
+ def show
+ # this gets called to fetch an activity after it has been pushed into the browser. The fetch
+ # is needed to generate the read raptor tracking id
+ @activity = Activity.find(params[:id])
+ case @activity.subject
+ when Event::Comment
+ @activity.subject.readraptor_tag = :chat
+ end
+ render json: @activity, serializer: ActivitySerializer
+ end
+
+ def index
+ @stream_events = StreamEvent.visible.page(page)
+ respond_to do |format|
+ format.js { render :layout => false }
+ format.html
+ end
+ end
+
+ protected
+ def page
+ [params[:page].to_i, 1].max
+ end
+end
| Add activity controller back in
|
diff --git a/app/controllers/api/base_controller.rb b/app/controllers/api/base_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/api/base_controller.rb
+++ b/app/controllers/api/base_controller.rb
@@ -13,5 +13,13 @@ def respond_with_conflict(json_hash)
render json: json_hash, status: :conflict
end
+
+ private
+
+ # Use logged in user (spree_current_user) for API authentication (current_api_user)
+ def authenticate_user
+ @current_api_user = try_spree_current_user
+ super
+ end
end
end
| Use logged in user (spree_current_user) for API authentication (current_api_user)
|
diff --git a/app/controllers/commutes_controller.rb b/app/controllers/commutes_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/commutes_controller.rb
+++ b/app/controllers/commutes_controller.rb
@@ -1,7 +1,13 @@ class CommutesController < ApplicationController
def startcommute
@commute = current_user.commutes.build()
- @commute.startcommute
+ begin
+ @commute.startcommute
+ rescue
+ flash[:error] = "An error occured. Do you already have a commute active?"
+ @commute.destroy
+ return redirect_to root_url
+ end
if @commute.save
current_user.hasActiveCommute = true
current_user.currentCommute = @commute.id
| Improve error checking for duplicate 'start commute' requests
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.