diff stringlengths 65 26.7k | message stringlengths 7 9.92k |
|---|---|
diff --git a/spec/lib/gitlab/prometheus/queries/additional_metrics_deployment_query_spec.rb b/spec/lib/gitlab/prometheus/queries/additional_metrics_deployment_query_spec.rb
index abc1234..def5678 100644
--- a/spec/lib/gitlab/prometheus/queries/additional_metrics_deployment_query_spec.rb
+++ b/spec/lib/gitlab/prometheus/queries/additional_metrics_deployment_query_spec.rb
@@ -9,6 +9,10 @@
subject(:query_result) { described_class.new(client).query(deployment.id) }
+ around do |example|
+ Timecop.freeze(Time.local(2008, 9, 1, 12, 0, 0)) { example.run }
+ end
+
include_examples 'additional metrics query' do
it 'queries using specific time' do
expect(client).to receive(:query_range).with(anything,
| Fix transient error in deployment test
|
diff --git a/omniauth-naverlogin.gemspec b/omniauth-naverlogin.gemspec
index abc1234..def5678 100644
--- a/omniauth-naverlogin.gemspec
+++ b/omniauth-naverlogin.gemspec
@@ -19,5 +19,5 @@ gem.add_development_dependency "rspec", "~> 3.3"
gem.add_development_dependency "webmock", "~> 1.21"
gem.add_development_dependency "rake", "~> 10.4"
- gem.add_development_dependency "bundler", "~> 1.10"
+ gem.add_development_dependency "bundler", "~> 1.0"
end | Downgrade bundle gem depedency version to pass Travis CI
|
diff --git a/lib/generators/spree_shipwire/install/install_generator.rb b/lib/generators/spree_shipwire/install/install_generator.rb
index abc1234..def5678 100644
--- a/lib/generators/spree_shipwire/install/install_generator.rb
+++ b/lib/generators/spree_shipwire/install/install_generator.rb
@@ -6,7 +6,7 @@ class_option :auto_run_migrations, type: :boolean, default: false
def add_initializer
- copy_file 'initializer.rb', 'config/initializers/spree_shipwire.rb'
+ copy_file 'initializer.rb', 'config/initializers/shipwire.rb'
end
def add_migrations
| Rename spree_shipwire initializer to shipwire.rb
|
diff --git a/spec/dbc/post_spec.rb b/spec/dbc/post_spec.rb
index abc1234..def5678 100644
--- a/spec/dbc/post_spec.rb
+++ b/spec/dbc/post_spec.rb
@@ -0,0 +1,23 @@+require 'spec_helper'
+
+RSpec.describe Dbc::Post do
+ it 'publishes drafted posts' do
+ drafted = Dbc::Post.new(title: 'Drafted',
+ body: 'Drafted before its time',
+ drafted_at: Time.now)
+
+ drafted.publish!
+
+ expect(drafted.drafted_at).to be_nil
+ expect(drafted.published_at).not_to be_nil
+ end
+
+ it 'drafts published posts' do
+ published = Dbc::Post.new(title: 'Published', body: 'Published too soon')
+
+ published.draft!
+
+ expect(published.published_at).to be_nil
+ expect(published.drafted_at).not_to be_nil
+ end
+end
| Add the post spec file
|
diff --git a/app/controllers/flags_controller.rb b/app/controllers/flags_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/flags_controller.rb
+++ b/app/controllers/flags_controller.rb
@@ -16,9 +16,9 @@
@flag = Flag.new(user_id: params[:user_id].to_i, flaggable: flaggable, flaggable_type: params[:flaggable_type].capitalize)
if @flag.save
- render json: {response: 'good'}
+ render json: @flag.id
else
- render json: {response: 'bad'}
+ render json: {response: '404, flag not saved'}
end
end
| Change flags contoller to return flag ID
|
diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/games_controller.rb
+++ b/app/controllers/games_controller.rb
@@ -5,10 +5,11 @@
#SHOW FORM
get '/games/new' do
-
+ erb :'games/new'
end
#CREATE
post '/games' do
+ @game = Game.new(params[:game])
end
| Correct errors from name change to games; create working seed file
|
diff --git a/app/controllers/api/committees_controller.rb b/app/controllers/api/committees_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/api/committees_controller.rb
+++ b/app/controllers/api/committees_controller.rb
@@ -1,9 +1,11 @@ class Api::CommitteesController < ApiController
def index
+ name = params[:name]
councillor_id = params[:councillor_id]
@committees = Committee.all
@committees = @committees.where("lower(name) LIKE ?", @@query) unless @@query.empty?
+ @committees = @committees.where("lower(name) = ?", name.downcase) if name.present?
@committees = @committees.joins(:committees_councillors).where("councillor_id = ?", councillor_id) if councillor_id.present?
paginate json: @committees.order(change_query_order), per_page: change_per_page
| Add URL Query For Name In API Committee
|
diff --git a/app/controllers/spree/checkout_controller.rb b/app/controllers/spree/checkout_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/spree/checkout_controller.rb
+++ b/app/controllers/spree/checkout_controller.rb
@@ -1,5 +1,11 @@ # frozen_string_literal: true
+# This controller (and respective route in the Spree engine)
+# is only needed for the spree_paypal_express gem that redirects here explicitly.
+#
+# According to the rails docs it would be possible to redirect
+# to CheckoutController directly in the routes
+# with a slash like "to: '/checkout#edit'", but it does not work in this case.
module Spree
class CheckoutController < Spree::StoreController
def edit
| Add doc to Spree::CheckoutController to make it more obvious why this controller exists
|
diff --git a/app/controllers/sites_controller.rb b/app/controllers/sites_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/sites_controller.rb
+++ b/app/controllers/sites_controller.rb
@@ -7,7 +7,7 @@ before_filter :find_personas, :only => [:create, :edit, :update]
def index
- @sites = @account.sites.find(:all, :include => :persona)
+ @sites = @account.sites.find(:all, :include => :persona, :order => :url)
respond_to do |format|
format.html
| Order sites list by url
|
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -6,7 +6,7 @@ skip_before_action :validate_accepted_role_terms!
def show
- @messages = current_user.messages.to_a
+ @messages = current_user.messages_in_organization
@watched_discussions = current_user.watched_discussions_in_organization
end
| Use messages_in_organization to retrieve user messages
|
diff --git a/spec/selenium/grades/gradezilla/gradebook_letter_grade_spec.rb b/spec/selenium/grades/gradezilla/gradebook_letter_grade_spec.rb
index abc1234..def5678 100644
--- a/spec/selenium/grades/gradezilla/gradebook_letter_grade_spec.rb
+++ b/spec/selenium/grades/gradezilla/gradebook_letter_grade_spec.rb
@@ -0,0 +1,51 @@+#
+# Copyright (C) 2018 - present Instructure, Inc.
+#
+# This file is part of Canvas.
+#
+# Canvas is free software: you can redistribute it and/or modify it under
+# the terms of the GNU Affero General Public License as published by the Free
+# Software Foundation, version 3 of the License.
+#
+# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Affero General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+
+require_relative '../../helpers/gradezilla_common'
+require_relative '../pages/gradezilla_page'
+require_relative '../pages/gradezilla_cells_page'
+
+describe "Gradezilla" do
+ include_context "in-process server selenium tests"
+ include GradezillaCommon
+
+ describe 'letter grade assignment grading' do
+ before :once do
+ init_course_with_students 1
+ @assignment = @course.assignments.create!(grading_type: 'letter_grade', points_possible: 10)
+ @assignment.grade_student(@students[0], grade: 'B', grader: @teacher)
+ end
+
+ before :each do
+ user_session(@teacher)
+ Gradezilla.visit(@course)
+ end
+
+ it 'is maintained in editable mode', priority: "1", test_id: 3438379 do
+ skip('This is skeleton code that acts as AC for GRADE-61 which is WIP')
+ Gradezilla::Cells.grading_cell(@students[0], @assignment).click
+ expect(Gradezilla::Cells.grade_cell_input(@students[0], @assignment)).to eq('B')
+ end
+
+ it 'is maintained on page refresh post grade update', priority: "1", test_id: 3438380 do
+ skip('This is skeleton code that acts as AC for GRADE-61 which is WIP')
+ Gradezilla::Cells.edit_grade(@students[0], @assignment, 'A')
+ refresh_page
+ expect(Gradezilla::Cells.get_grade(@students[0], @assignment)).to eq('A')
+ end
+ end
+end
| Spec: Add Spec for Letter Grade
refs: GRADE-61
Test Plan:
--- Passes Jenkins
Change-Id: I178774d5e0a68f09926ee6c5c2c20e2459986148
Reviewed-on: https://gerrit.instructure.com/138707
Tested-by: Jenkins
Reviewed-by: Anju Reddy <851202533fb1f0b615e4547ba226c76996d060dd@instructure.com>
Reviewed-by: Jeremy Neander <20252aad5efdc666f083d82ab63ed0f9f72a043e@instructure.com>
Product-Review: Indira Pai <9d2d5fa73bc5f5239dec42fbfd2a2b8495480e96@instructure.com>
QA-Review: Indira Pai <9d2d5fa73bc5f5239dec42fbfd2a2b8495480e96@instructure.com>
|
diff --git a/lib/hexun/fund.rb b/lib/hexun/fund.rb
index abc1234..def5678 100644
--- a/lib/hexun/fund.rb
+++ b/lib/hexun/fund.rb
@@ -8,18 +8,14 @@ @symbol = symbol.to_i
end
- def quotes(type = :nav)
+ def quotes
doc = Nokogiri::XML(open("http://data.funds.hexun.com/outxml/detail/openfundnetvalue.ashx?fundcode=#{@symbol}"))
- key = case type
- when :nav then "fld_unitnetvalue" # Net Asset Value
- when :auv then "fld_netvalue" # Accumulated Unit Value
- end
quotes = TimeSeries.new
doc.root.xpath("Data").each do |quote|
quotes << DataPoint.new(
Date.parse(quote.xpath("fld_enddate").text),
- quote.xpath(key).text.to_f
+ quote.xpath('fld_unitnetvalue').text.to_f
)
end
| Drop the support for Accumulated Unit Value
|
diff --git a/lib/koi/engine.rb b/lib/koi/engine.rb
index abc1234..def5678 100644
--- a/lib/koi/engine.rb
+++ b/lib/koi/engine.rb
@@ -7,7 +7,7 @@
initializer "static assets" do |app|
app.middleware.use ::ActionDispatch::Static, "#{root}/public"
- app.middleware.use Koi::UrlRedirect
+ app.middleware.insert_before Rack::Sendfile, Koi::UrlRedirect
app.config.assets.precompile += %w(
koi.js
koi/nav_items.js
| Fix: Insert UrlRewrite middleware before Rack::Sendfile
* This was present in previous versions of Koi but was removed by mistake
|
diff --git a/lib/poker_hand.rb b/lib/poker_hand.rb
index abc1234..def5678 100644
--- a/lib/poker_hand.rb
+++ b/lib/poker_hand.rb
@@ -48,20 +48,22 @@ end
def cards_occurring(times)
- counts.select do |value, count|
+ counts_by_value.select do |value, count|
count == times
end
end
- def counts
- @cards.each_with_object(Hash.new(0)) do |card, hash|
- hash[card.value] += 1
- end
+ def counts_by_value
+ counts_by { |card| card.value }
end
def counts_by_suit
+ counts_by { |card| card.suit }
+ end
+
+ def counts_by(&predicate)
@cards.each_with_object(Hash.new(0)) do |card, hash|
- hash[card.suit] += 1
+ hash[predicate.call card] += 1
end
end
| Make the card counting algorithm generic
|
diff --git a/lib/resa/event.rb b/lib/resa/event.rb
index abc1234..def5678 100644
--- a/lib/resa/event.rb
+++ b/lib/resa/event.rb
@@ -3,8 +3,8 @@ include Mongoid::Document
include Mongoid::Timestamps
field :title, :type => String
- field :dtstart, :type => DateTime
- field :dtend, :type => DateTime
+ field :dtstart, :type => Time
+ field :dtend, :type => Time
belongs_to :location, class_name: 'Resa::Location', inverse_of: :event
belongs_to :organizer, class_name: 'MongoidUser', inverse_of: :events
| Use Time instead of DateTime (again)
for speed and bugged with mongoid:
see https://github.com/mongoid/mongoid/issues/1135
Signed-off-by: Laurent Arnoud <f1b010126f61b5c59e7d5eb42c5c68f6105c5914@spkdev.net>
|
diff --git a/test/app_test.rb b/test/app_test.rb
index abc1234..def5678 100644
--- a/test/app_test.rb
+++ b/test/app_test.rb
@@ -21,25 +21,13 @@ assert last_response.body.include?('OK')
end
- def test_200_response
- get '/code/200'
+ KNOWN_HTTP_CODES.each do |code, content|
+ define_method "test_#{code}_response" do
+ get "/code/#{code}"
- assert last_response.ok?
- assert last_response.body.include?('OK')
- end
-
- def test_404_response
- get '/code/404'
-
- assert last_response.not_found?
- assert last_response.body.include?('Not Found')
- end
-
- def test_500_response
- get '/code/500'
-
- assert last_response.server_error?
- assert last_response.body.include?('Server Error')
+ assert last_response.status == code
+ assert last_response.body.include?(content) unless no_body_expected?(code)
+ end
end
def test_slow_response
@@ -55,4 +43,10 @@ assert last_response.status == 302
assert_equal 'http://example.org/infinite', last_request.url
end
+
+ private
+
+ def no_body_expected?(code)
+ [204, 205, 304].include? code
+ end
end
| Test all codes defined in app
|
diff --git a/librarian.gemspec b/librarian.gemspec
index abc1234..def5678 100644
--- a/librarian.gemspec
+++ b/librarian.gemspec
@@ -11,6 +11,7 @@ gem.summary = %q{A Framework for Bundlers.}
gem.description = %q{A Framework for Bundlers.}
gem.homepage = ""
+ gem.license = "MIT"
gem.files = `git ls-files`.split($/)
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
| Mark the license in the gemspec.
|
diff --git a/lib/puppet-lint/plugins/duplicate_class_parameters.rb b/lib/puppet-lint/plugins/duplicate_class_parameters.rb
index abc1234..def5678 100644
--- a/lib/puppet-lint/plugins/duplicate_class_parameters.rb
+++ b/lib/puppet-lint/plugins/duplicate_class_parameters.rb
@@ -19,36 +19,35 @@ end
next unless level.zero?
+ next unless token.type == :VARIABLE
- if token.type == :VARIABLE
- next_type = token.next_code_token.type
+ next_type = token.next_code_token.type
- # handling for lines with an equals and a variable on the rhs
- if next_type == :EQUALS
- inside = true
+ # handling for lines with an equals and a variable on the rhs
+ if next_type == :EQUALS
+ inside = true
- two_away = token.next_code_token.next_code_token.type
- if two_away == :DQPRE
- inside = false
- end
- elsif next_type == :COMMA
+ two_away = token.next_code_token.next_code_token.type
+ if two_away == :DQPRE
inside = false
end
+ elsif next_type == :COMMA
+ inside = false
+ end
- # only proceed if we're at the end of a declaration.
- next if !inside
+ # only proceed if we're at the end of a declaration.
+ next unless inside
- param_name = token.value
- seen[param_name] += 1
+ param_name = token.value
+ seen[param_name] += 1
- if seen[param_name] > 1
- # warning output shows the parameter location each additional time it's seen
- notify :warning, {
- :message => "found duplicate parameter '#{param_name}' in class '#{class_name}'",
- :line => token.line,
- :column => token.column,
- }
- end
+ if seen[param_name] > 1
+ # warning output shows the parameter location each additional time it's seen
+ notify :warning, {
+ message: "found duplicate parameter '#{param_name}' in class '#{class_name}'",
+ line: token.line,
+ column: token.column,
+ }
end
end
end
| Replace an if with an early next and remove an indentation level
8 rubocops to go!
|
diff --git a/scripts/recalc_abilities_for_all_users.rb b/scripts/recalc_abilities_for_all_users.rb
index abc1234..def5678 100644
--- a/scripts/recalc_abilities_for_all_users.rb
+++ b/scripts/recalc_abilities_for_all_users.rb
@@ -7,6 +7,10 @@ puts " Attempt CommunityUser.Id=#{cu.id}"
RequestContext.community = cu.community
cu.recalc_privileges
+
+ if (cu.is_moderator || cu.is_admin || u.is_global_moderator || u.is_global_admin) && !cu.privilege?('mod')
+ cu.grant_privilege('mod')
+ end
rescue
puts " !!! Error recalcing for CommunityUser.Id=#{cu.id}"
end
| Add enforcement for moderator ability to recalc script
|
diff --git a/spec/active_model/allow_values_for_spec.rb b/spec/active_model/allow_values_for_spec.rb
index abc1234..def5678 100644
--- a/spec/active_model/allow_values_for_spec.rb
+++ b/spec/active_model/allow_values_for_spec.rb
@@ -9,7 +9,7 @@ build_class(:User) { include ActiveModel::Validations }
end
- before { model.validates(attribute, format: /^\d+$/) }
+ before { model.validates(attribute, :format => /^\d+$/) }
subject { model.new }
| Switch to Ruby 1.8 hash syntax.
|
diff --git a/lib/webdriver_script_adapter/execute_async_script_adapter.rb b/lib/webdriver_script_adapter/execute_async_script_adapter.rb
index abc1234..def5678 100644
--- a/lib/webdriver_script_adapter/execute_async_script_adapter.rb
+++ b/lib/webdriver_script_adapter/execute_async_script_adapter.rb
@@ -15,8 +15,8 @@ module ScriptWriter
module_function
- def async_results_identifier(key)
- "window['#{key}']"
+ def async_results_identifier
+ "window['#{ WebDriverScriptAdapter.generate_async_results_identifier.call }']"
end
def callback(resultsIdentifier)
@@ -34,7 +34,7 @@ end
def execute_async_script(script, *args)
- results = ScriptWriter.async_results_identifier(::SecureRandom.uuid)
+ results = ScriptWriter.async_results_identifier
execute_script ScriptWriter.async_wrapper(script, *args, ScriptWriter.callback(results))
wait_until { evaluate_script results }
end
| Use the configured results identifier generator
|
diff --git a/spec/image_downloader_adapter_base_spec.rb b/spec/image_downloader_adapter_base_spec.rb
index abc1234..def5678 100644
--- a/spec/image_downloader_adapter_base_spec.rb
+++ b/spec/image_downloader_adapter_base_spec.rb
@@ -0,0 +1,36 @@+klass = ImageDownloaderAdapter::Base
+
+describe klass do
+ xit 'should download img tags with src in scheme http' do
+ end
+
+ xit 'should download img tags with src in scheme http' do
+ end
+
+ xit 'should download img tags with srcset in scheme http' do
+ end
+
+ xit 'should download img tags with src in scheme https' do
+ end
+
+ xit 'should download img tags with srcset in scheme https' do
+ end
+
+ xit 'should download img tags with embedded images' do
+ end
+
+ xit 'should download elements with background property in style attr' do
+ end
+
+ xit 'should download elements with background-image property in style attr' do
+ end
+
+ xit 'should download elements with background property in stylesheet' do
+ end
+
+ xit 'should download elements with background-image property in stylesheet' do
+ end
+
+ xit 'should download lazily loaded elements' do
+ end
+end
| Implement pending specs for ImageDownloaderAdapter::Base
|
diff --git a/test/hal_api/paged_collection_test.rb b/test/hal_api/paged_collection_test.rb
index abc1234..def5678 100644
--- a/test/hal_api/paged_collection_test.rb
+++ b/test/hal_api/paged_collection_test.rb
@@ -0,0 +1,83 @@+require 'test_helper'
+require 'hal_api/paged_collection'
+require 'test_models'
+require 'kaminari'
+require 'kaminari/models/array_extension'
+
+describe HalApi::PagedCollection do
+
+ let(:items) { (0..25).collect{|t| TestObject.new("test #{t}", true) } }
+ let(:paged_items) { Kaminari::paginate_array(items).page(1).per(10) }
+ let(:paged_collection) { HalApi::PagedCollection.new(paged_items, OpenStruct.new(params: {})) }
+
+ it 'creates a paged collection' do
+ paged_collection.wont_be_nil
+ paged_collection.items.wont_be_nil
+ paged_collection.request.wont_be_nil
+ end
+
+ it 'has delegated methods' do
+ paged_collection.request.params.must_equal Hash.new
+ paged_collection.params.must_equal Hash.new
+
+ paged_collection.items.count.must_equal 10
+ paged_collection.count.must_equal 10
+ paged_collection.items.total_count.must_equal 26
+ paged_collection.total.must_equal 26
+ end
+
+ it 'implements to_model' do
+ paged_collection = HalApi::PagedCollection.new([])
+ paged_collection.to_model.must_equal paged_collection
+ end
+
+ it 'is never persisted' do
+ paged_collection = HalApi::PagedCollection.new([])
+ paged_collection.wont_be :persisted?
+ end
+
+ it 'has a stubbed request by default' do
+ paged_collection = HalApi::PagedCollection.new([])
+ paged_collection.params.must_equal Hash.new
+ end
+
+ it 'will be a root resource be default' do
+ paged_collection.is_root_resource.must_equal true
+ end
+
+ it 'will be a root resource based on options' do
+ paged_collection.options[:is_root_resource] = false
+ paged_collection.is_root_resource.must_equal false
+ end
+
+ it 'has an item_class' do
+ paged_collection.item_class.must_equal(TestObject)
+ end
+
+ it 'has an item_decorator' do
+ paged_collection.item_decorator.must_equal(Api::TestObjectRepresenter)
+ end
+
+ it 'has an url' do
+ paged_collection.options[:url] = "test"
+ paged_collection.url.must_equal "test"
+ end
+
+ it 'has a parent' do
+ class TestFoo
+ def self.columns
+ @columns ||= [];
+ end
+ end
+
+ class TestBar < TestFoo
+ def becomes(klass); klass.new; end
+ def self.base_class; TestFoo; end
+ end
+
+ a = TestBar.new
+ a.wont_be_instance_of TestFoo
+ paged_collection.options[:parent] = a
+ paged_collection.parent.must_be_instance_of TestFoo
+ end
+end
| Add tests for paged collections
|
diff --git a/spec/features/execute_adhoc_query_spec.rb b/spec/features/execute_adhoc_query_spec.rb
index abc1234..def5678 100644
--- a/spec/features/execute_adhoc_query_spec.rb
+++ b/spec/features/execute_adhoc_query_spec.rb
@@ -4,10 +4,16 @@ scenario 'Visit root, input query and generate report then we get a report' do
visit '/adhoq'
+ fill_in 'Query', with: 'SELECT * from adhoq_queries'
+ click_link 'Explain'
+ first('a.js-explain-button').click
+ expect(find('.js-explain-result')).to have_content(/SCAN TABLE adhoq_querie/)
+
fill_in 'Name', with: 'My new query'
fill_in 'Description', with: 'Description about this query'
fill_in 'Query', with: 'SELECT 42 AS "answer number", "Hello adhoq" AS message'
+ click_link 'Preview'
first('a.js-preview-button').click
within '.js-preview-result' do
expect(page).to have_content('Hello')
| Fix execute adhoc query scenario for Explain
|
diff --git a/mimemagic.gemspec b/mimemagic.gemspec
index abc1234..def5678 100644
--- a/mimemagic.gemspec
+++ b/mimemagic.gemspec
@@ -19,6 +19,8 @@ s.homepage = 'https://github.com/minad/mimemagic'
s.license = 'MIT'
+ s.add_dependency('nokogiri', '~> 1.11.2')
+
s.add_development_dependency('minitest', '~> 5.14')
s.add_development_dependency('rake', '~> 13.0')
| Add a dependency on Nokogiri
|
diff --git a/spec/features/idea_features_spec.rb b/spec/features/idea_features_spec.rb
index abc1234..def5678 100644
--- a/spec/features/idea_features_spec.rb
+++ b/spec/features/idea_features_spec.rb
@@ -2,8 +2,20 @@ require 'faker'
describe "IdeaFeatures" do
- describe "Creating new ideas" do
+ describe "Create new ideas" do
+ before do
+ @user = create(:user)
+ @user.confirm!
+ end
+
it "should create a new idea" do
+ visit new_user_session_path
+
+ fill_in "Email", :with => "#{@user.email}"
+ fill_in "Password", :with => "#{@user.password}"
+
+ click_button "Sign in"
+
visit new_idea_path
fill_in "new-idea-title", :with => Faker::Lorem.sentence
| Test idea features with registered user
Before requesting the new idea page, sign in with a registered and
confirmed test user.
|
diff --git a/app/models/feeder/feedable_observer.rb b/app/models/feeder/feedable_observer.rb
index abc1234..def5678 100644
--- a/app/models/feeder/feedable_observer.rb
+++ b/app/models/feeder/feedable_observer.rb
@@ -23,11 +23,13 @@ def after_save(feedable)
item = feedable.feeder_item
- if feedable.respond_to? :sticky
- item.sticky = feedable.sticky
+ if item
+ if feedable.respond_to? :sticky
+ item.sticky = feedable.sticky
+ end
+
+ item.save!
end
-
- item.save!
end
private
| Fix a bug that caused FeedableObserver to crash for feedables without feed items
|
diff --git a/app/models/metasploit/cache/license.rb b/app/models/metasploit/cache/license.rb
index abc1234..def5678 100644
--- a/app/models/metasploit/cache/license.rb
+++ b/app/models/metasploit/cache/license.rb
@@ -7,7 +7,7 @@ #
# @!attribute abbreviation
- # Abbreviated license name
+ # Short name of this license, e.g. "BSD-2"
#
# @return [String]
@@ -39,6 +39,25 @@ presence: true
+ # @!method abbreviation=(abbreviation)
+ # Sets {#abbreviation}.
+ #
+ # @param abbreviation [String] short name of this license, e.g. "BSD-2"
+ # @return [void]
+
+ # @!method summary=(summary)
+ # Sets {#summary}.
+ #
+ # @param summary [String] summary of the license text
+ # @return [void]
+
+ # @!method url=(url)
+ # Sets {#url}.
+ #
+ # @param url [String] URL to the location of the full license text
+ # @return [void]
+
+
Metasploit::Concern.run(self)
end
| Add some documentation to satisfy YARD plugin
MSP-12434
|
diff --git a/app/models/thermostat_schedule_rule.rb b/app/models/thermostat_schedule_rule.rb
index abc1234..def5678 100644
--- a/app/models/thermostat_schedule_rule.rb
+++ b/app/models/thermostat_schedule_rule.rb
@@ -12,15 +12,15 @@ where( sunday: true )
elsif day == 1
where( monday: true )
- elsif day == 1
+ elsif day == 2
where( tuesday: true )
- elsif day == 1
+ elsif day == 3
where( wednesday: true )
- elsif day == 1
+ elsif day == 4
where( thursday: true )
- elsif day == 1
+ elsif day == 5
where( friday: true )
- elsif day == 1
+ elsif day == 6
where( saturday: true )
end
}
| Fix logic for schedule rules active on day.
|
diff --git a/tests/spec/features/tools_spec.rb b/tests/spec/features/tools_spec.rb
index abc1234..def5678 100644
--- a/tests/spec/features/tools_spec.rb
+++ b/tests/spec/features/tools_spec.rb
@@ -20,7 +20,7 @@ within('.header') { click_on("Clippy") }
within(".output-stderr") do
- expect(page).to have_content 'warn(eq_op)'
+ expect(page).to have_content 'deny(eq_op)'
expect(page).to have_content 'warn(zero_divided_by_zero)'
end
end
| Update test to reflect Clippy changes
|
diff --git a/app/models/stage_action.rb b/app/models/stage_action.rb
index abc1234..def5678 100644
--- a/app/models/stage_action.rb
+++ b/app/models/stage_action.rb
@@ -23,6 +23,7 @@
id = BSON::ObjectId.from_string(id) if id.is_a?(String)
- Stage.where("stage_actions._id" => id).first
+ Stage.where("stage_actions._id" => id).first.stage_actions.where({_id: id}).first
+
end
end
| Return stage action for StageAction.find
|
diff --git a/scripts/debugging/two-invocations-for-edge-flows-velocity-comparison.rb b/scripts/debugging/two-invocations-for-edge-flows-velocity-comparison.rb
index abc1234..def5678 100644
--- a/scripts/debugging/two-invocations-for-edge-flows-velocity-comparison.rb
+++ b/scripts/debugging/two-invocations-for-edge-flows-velocity-comparison.rb
@@ -0,0 +1,82 @@+
+class EdgeData
+
+ attr_accessor :flow, :velocity
+
+end
+
+def do_one_analysis
+ output = `../../it.unifi.dsi.stlab.networkreasoner.console.emacs/bin/Debug/it.unifi.dsi.stlab.networkreasoner.console.emacs.exe < \
+ ../../it.unifi.dsi.stlab.networkreasoner.console.emacs/bin/Debug/emacs-buffers-examples/big-network-for-integration.org`
+
+ splitted = output.split "\n"
+ edge_results_start_index = splitted.find_index do |aString|
+ aString == "| EDGE ID | LINK | FLOW | VELOCITY |"
+ end
+ edge_results_start_index += 2
+
+
+ edge_results_end_index = splitted.find_index do |aString|
+ aString == "* Dot representations"
+ end
+ edge_results_end_index -= 4
+
+# output_string = "edge result table starts at #{edge_results_start_index}
+# and ends at #{edge_results_end_index}"
+# puts output_string
+
+ edge_results_table = splitted.slice edge_results_start_index..edge_results_end_index
+# puts edge_results_table
+
+ map = Hash.new
+
+ edge_results_table.each do |aString|
+
+ splitted = aString.split "|"
+
+ analysis_data = EdgeData.new
+ analysis_data.flow = splitted[3].to_f
+ analysis_data.velocity = splitted[4].to_f
+
+ map[splitted[1]] = analysis_data
+ end
+
+ return map
+end
+
+
+def test
+
+ map_of_first_analysis = do_one_analysis
+ map_of_second_analysis = do_one_analysis
+
+# puts map_of_first_analysis
+
+ combined_map = Hash.new
+
+ map_of_second_analysis.each do |key,value|
+
+ inner_map = Hash.new
+ inner_map[:flow] = value.flow - map_of_first_analysis[key].flow
+ inner_map[:velocity] = value.velocity - map_of_first_analysis[key].velocity
+
+ combined_map[key] = inner_map
+
+ end
+
+ org_string = ""
+ org_string += "|edge_id|flow comp|velocity comp|\n"
+ org_string += "|-\n"
+
+ combined_map.each do |key,value|
+
+ org_string += "|#{key}|#{value[:flow]}|#{value[:velocity]}|\n"
+
+ end
+
+ org_string += "|-\n"
+
+ puts org_string
+end
+
+test
| Write a Ruby script in order to perform two simulation and compare
the results about flows and velocity for edge objects.
|
diff --git a/queue_classic_admin.gemspec b/queue_classic_admin.gemspec
index abc1234..def5678 100644
--- a/queue_classic_admin.gemspec
+++ b/queue_classic_admin.gemspec
@@ -18,7 +18,7 @@ s.test_files = Dir["test/**/*"]
s.add_dependency "rails", ">= 4.0.9"
- s.add_dependency "queue_classic", "~> 3.0"
+ s.add_dependency "queue_classic", ">= 3.0"
s.add_dependency "pg"
s.add_dependency "will_paginate", ">= 3.0.0"
s.add_dependency "will_paginate-bootstrap", ">= 0.2.0"
| Allow matching with QC > 3
|
diff --git a/redis-actionpack/test/dummy/config/initializers/session_store.rb b/redis-actionpack/test/dummy/config/initializers/session_store.rb
index abc1234..def5678 100644
--- a/redis-actionpack/test/dummy/config/initializers/session_store.rb
+++ b/redis-actionpack/test/dummy/config/initializers/session_store.rb
@@ -1,7 +1,9 @@ # Be sure to restart your server when you modify this file.
Dummy::Application.config.session_store :redis_store,
- :key => '_session_id'
+ :key => '_session_id',
+ :redis_server => ["redis://127.0.0.1:6380/1/theplaylist",
+ "redis://127.0.0.1:6381/1/theplaylist"]
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
| Integrate against a distributed Redis store
|
diff --git a/lib/litmus_paper/dependency/tcp.rb b/lib/litmus_paper/dependency/tcp.rb
index abc1234..def5678 100644
--- a/lib/litmus_paper/dependency/tcp.rb
+++ b/lib/litmus_paper/dependency/tcp.rb
@@ -13,8 +13,8 @@
Timeout.timeout(@timeout) do
socket = TCPSocket.new(@ip, @port)
- if @input_data || @expected_output
- socket.puts(@input_data.to_s)
+ if @expected_output
+ socket.puts(@input_data) if @input_data
data = socket.gets
response = data.chomp == @expected_output
LitmusPaper.logger.info("Response (#{response}) does not match expected output (#{@expected_output})")
| Stop writing into the socket when input_data is not supplied.
|
diff --git a/lib/scalene/commands/buckets/remove.rb b/lib/scalene/commands/buckets/remove.rb
index abc1234..def5678 100644
--- a/lib/scalene/commands/buckets/remove.rb
+++ b/lib/scalene/commands/buckets/remove.rb
@@ -35,7 +35,7 @@ display_error_message(error)
end
else
- error "You don't have a bucket named '#{name}'."
+ error "You don't have a bucket named '#{name}'.", :not_found
end
end
| Add missing error exit status.
|
diff --git a/test/fixtures/cookbooks/nexus3_test/recipes/delete_script.rb b/test/fixtures/cookbooks/nexus3_test/recipes/delete_script.rb
index abc1234..def5678 100644
--- a/test/fixtures/cookbooks/nexus3_test/recipes/delete_script.rb
+++ b/test/fixtures/cookbooks/nexus3_test/recipes/delete_script.rb
@@ -26,6 +26,10 @@ password 'admin123'
action :delete
- retries 10
- retry_delay 10
+ notifies :run, 'ruby_block[fail if bar is deleted again]', :immediately
end
+
+ruby_block 'fail if bar is deleted again' do
+ action :nothing
+ block { raise 'nexus3_api is not idempotent!' }
+end
| Make sure deleting a repo is not called twice in a row
|
diff --git a/lib/tasks/check_for_new_revisions.rake b/lib/tasks/check_for_new_revisions.rake
index abc1234..def5678 100644
--- a/lib/tasks/check_for_new_revisions.rake
+++ b/lib/tasks/check_for_new_revisions.rake
@@ -1,3 +1,9 @@+task :kill_dead_builds => :environment do
+ timestamp = Time.now - 1000
+
+ builds = Build.where('status = ? AND started_at < ?', 'running', timestamp)
+ builds.update_all(:status => 'failed:dead')
+end
task :check_for_new_revisions => :environment do
since = 6.hours
| Add Rake task to deal with dead builds
|
diff --git a/lib/wulin_master/grid/grid_relation.rb b/lib/wulin_master/grid/grid_relation.rb
index abc1234..def5678 100644
--- a/lib/wulin_master/grid/grid_relation.rb
+++ b/lib/wulin_master/grid/grid_relation.rb
@@ -8,7 +8,9 @@ if options[:screen]
detail_model = self.model
master_grid = master_grid_klass.constantize.new({screen: options[:screen], format:'json'}) # format as json to skip the toolbar and styling initialize
- through = options[:through] || detail_model.reflections[master_grid.model.to_s.underscore.intern].foreign_key
+ through = options[:through] ||
+ detail_model.reflections[master_grid.model.to_s.underscore.intern].try(:foreign_key) || # detail_model belongs_to master_model
+ detail_model.reflections[master_grid.model.to_s.underscore.pluralize.intern].try(:foreign_key) # detail_model has_many master_model
# disable the multiSelect for master grid
master_grid_klass.constantize.options_pool << {:multiSelect => false, :only => [options[:screen].intern]}
| Refactor 30m - master-detail grid, add the case of has_and_belongs_to_many
|
diff --git a/webapp/rails/trunk/db/migrate/20090302210151_increase_db_field_sizes.rb b/webapp/rails/trunk/db/migrate/20090302210151_increase_db_field_sizes.rb
index abc1234..def5678 100644
--- a/webapp/rails/trunk/db/migrate/20090302210151_increase_db_field_sizes.rb
+++ b/webapp/rails/trunk/db/migrate/20090302210151_increase_db_field_sizes.rb
@@ -0,0 +1,11 @@+class IncreaseDbFieldSizes < ActiveRecord::Migration
+ def self.up
+ change_column :events, :description, :text
+ change_column :events, :summary, :string, :limit => 1024
+ end
+
+ def self.down
+ change_column :events, :description, :string, :limit => 500
+ change_column :events, :summary, :string, :limit => 100
+ end
+end
| Fix for OLIO-57: Increased size of description and summary to increase database size
git-svn-id: 9e8631a84d97bf96d7d440e76c2e3d95216d1dc3@749436 13f79535-47bb-0310-9956-ffa450edef68
|
diff --git a/tests/clippy.rb b/tests/clippy.rb
index abc1234..def5678 100644
--- a/tests/clippy.rb
+++ b/tests/clippy.rb
@@ -2,32 +2,32 @@ unless defined?(Gem) then require 'rubygems' end
require 'minitest/autorun'
require 'minitest/pride'
+require 'minitest/spec'
require 'clippy'
-class TestClippy < MiniTest::Unit::TestCase
-
- def test1_version
- Clippy.version.split(/\./).delete_if do
- |val|
- val =~ /pre\d{0,2}/
- end.length.must_equal(3)
+describe Clippy do subject { Clippy }
+ it "must have a proper version" do
+ Clippy.version.split(".").delete_if { |val|
+ val =~ /pre\d+/ }.length.must_equal(3)
end
- def test2_copy
- test1 = Clippy.copy("Test1")
- test1.must_equal("Test1")
- Clippy.paste.must_equal("Test1")
+ describe ".copy" do
+ it "must be able to copy" do
+ subject.copy("example").must_equal("example")
+ end
end
- def test3_paste
- test1 = Clippy.copy("Test2")
- test1.must_equal("Test2")
- Clippy.paste.must_equal("Test2")
+ describe ".paste" do
+ it "must be able to paste" do
+ subject.copy("example")
+ subject.paste.must_equal("example")
+ end
end
- def test4_clear
- Clippy.copy("Test2")
- Clippy.clear.must_equal(false)
- Clippy.paste.must_equal(false)
+ describe ".clear" do
+ it "should be able to clear the clipboard" do
+ subject.copy("example")
+ subject.clear.must_equal(true)
+ end
end
-end
+end | Update the tests so they are easier to read and understand. |
diff --git a/test/unit/workers/publishing_api_draft_worker_test.rb b/test/unit/workers/publishing_api_draft_worker_test.rb
index abc1234..def5678 100644
--- a/test/unit/workers/publishing_api_draft_worker_test.rb
+++ b/test/unit/workers/publishing_api_draft_worker_test.rb
@@ -5,14 +5,16 @@ include GdsApi::TestHelpers::PublishingApiV2
test "registers a draft edition with the publishing api" do
- edition = create(:draft_case_study)
- presenter = PublishingApiPresenters.presenter_for(edition)
- content_request = stub_publishing_api_put_content(presenter.as_json[:content_id], presenter.as_json.except(:links))
- links_request = stub_publishing_api_put_links(presenter.as_json[:content_id], presenter.as_json.slice(:links))
+ edition = create(:draft_case_study)
+ presenter = PublishingApiPresenters.presenter_for(edition)
+
+ requests = [
+ stub_publishing_api_put_content(presenter.content_id, presenter.content),
+ stub_publishing_api_put_links(presenter.content_id, links: presenter.links)
+ ]
PublishingApiDraftWorker.new.perform(edition.class.name, edition.id)
- assert_requested content_request
- assert_requested links_request
+ assert_all_requested requests
end
end
| Update Draft worker for new format
|
diff --git a/db/populate_admins.rb b/db/populate_admins.rb
index abc1234..def5678 100644
--- a/db/populate_admins.rb
+++ b/db/populate_admins.rb
@@ -14,5 +14,4 @@ password: "password",
password_confirmation: "password"
end
-
end
| Set the pagination to 30 per page
|
diff --git a/ruby-solutions/find_the_difference.rb b/ruby-solutions/find_the_difference.rb
index abc1234..def5678 100644
--- a/ruby-solutions/find_the_difference.rb
+++ b/ruby-solutions/find_the_difference.rb
@@ -0,0 +1,25 @@+# @param {String} s
+# @param {String} t
+# @return {Character}
+def find_the_difference(s, t)
+ output = ""
+ dict = {}
+ s.chars.map do |val|
+ dict[val] = dict[val] ? dict[val] += 1 : 1
+
+ end
+ t.chars.map do |val|
+ dict[val] = dict[val] ? dict[val] += 1 : 1
+ end
+
+
+ dict.keys.map do |key|
+ output << key if dict[key] % 2 != 0
+ end
+
+ output
+
+end
+
+p find_the_difference("abcd", "abcde")
+p find_the_difference("a", "aa") | Add solution to find the difference in ruby
|
diff --git a/app/controllers/capcoauth/logout_controller.rb b/app/controllers/capcoauth/logout_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/capcoauth/logout_controller.rb
+++ b/app/controllers/capcoauth/logout_controller.rb
@@ -4,7 +4,8 @@ token = session[:capcoauth_access_token]
session.destroy
OAuth::TTLCache.remove(token) if token.present?
- redirect_to "#{Capcoauth.configuration.capcoauth_url}/users/sign_out", notice: 'You have been logged out'
+ redirect_url = URI.encode_www_form_component(root_url)
+ redirect_to "#{Capcoauth.configuration.capcoauth_url}/users/sign_out?return_to=#{redirect_url}", notice: 'You have been logged out'
end
end
end
| Send return_to parameter to CapcOAuth logout
|
diff --git a/app/helpers/container_image_registry_helper.rb b/app/helpers/container_image_registry_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/container_image_registry_helper.rb
+++ b/app/helpers/container_image_registry_helper.rb
@@ -1,4 +1,4 @@-module ContainerImageRegistryHelper
+module ContainerImageRegistryHelper
include_concern 'ContainerSummaryHelper'
include_concern 'TextualSummary'
end
| Fix rubocop warnings in ContainerImageRegistryHelper
|
diff --git a/app/uploaders/mailboxer/attachment_uploader.rb b/app/uploaders/mailboxer/attachment_uploader.rb
index abc1234..def5678 100644
--- a/app/uploaders/mailboxer/attachment_uploader.rb
+++ b/app/uploaders/mailboxer/attachment_uploader.rb
@@ -5,7 +5,7 @@ "public/messages/#{model.id}/attachment"
end
- def extension_white_list
- %w(jpg jpeg png pdf)
- end
+ # def extension_white_list
+ # %w(jpg jpeg png pdf)
+ # end
end
| Remove attachment file extension restrick
|
diff --git a/tests/spec/weave/weave_spec.rb b/tests/spec/weave/weave_spec.rb
index abc1234..def5678 100644
--- a/tests/spec/weave/weave_spec.rb
+++ b/tests/spec/weave/weave_spec.rb
@@ -16,12 +16,27 @@ describe file('/etc/network/interfaces.d/weave.cfg') do
it { should be_file }
its(:content) { should match /iface weave inet manual/ }
+ it { should be_mode 644 }
end
describe docker_container('weave') do
it { should be_running }
end
+describe docker_container('weavescope') do
+ it { should be_running }
+end
+
+describe file('/etc/init/weave.conf') do
+ it { should be_file }
+ it { should be_mode 755 }
+end
+
+describe file('/etc/init/weavescope.conf') do
+ it { should be_file }
+ it { should be_mode 755 }
+end
+
describe file('/etc/default/docker') do
it { should be_file }
its(:content) { should match /--bridge=weave/ }
| Improve spec tests around weave/weavescope
|
diff --git a/rubyinstaller-build.gemspec b/rubyinstaller-build.gemspec
index abc1234..def5678 100644
--- a/rubyinstaller-build.gemspec
+++ b/rubyinstaller-build.gemspec
@@ -23,6 +23,6 @@ spec.require_paths = ["lib"]
spec.add_development_dependency "rake", "~> 12.0"
- spec.add_development_dependency "bundler", "~> 1.14"
+ spec.add_development_dependency "bundler", ">= 1.14", "< 3"
spec.add_development_dependency "minitest", "~> 5.0"
end
| Allow bundler-2.x which is included in ruby-2.6
|
diff --git a/spec/routing/sessions_routing_spec.rb b/spec/routing/sessions_routing_spec.rb
index abc1234..def5678 100644
--- a/spec/routing/sessions_routing_spec.rb
+++ b/spec/routing/sessions_routing_spec.rb
@@ -0,0 +1,15 @@+require 'rails_helper'
+
+RSpec.describe 'Routing to sessions', type: :routing do
+ it 'routes POST /sessions to sessions#create' do
+ expect(post: '/sessions').to route_to('sessions#create')
+ end
+
+ it 'routes GET /sessions/new to sessions#new' do
+ expect(get: '/sessions/new').to route_to('sessions#new')
+ end
+
+ it 'routes DELETE /sessions/1 to sessions#destroy' do
+ expect(delete: '/sessions/1').to route_to('sessions#destroy', id: '1')
+ end
+end
| Add tests for sessions routing
|
diff --git a/activesupport/lib/active_support/core_ext/module/attr_internal.rb b/activesupport/lib/active_support/core_ext/module/attr_internal.rb
index abc1234..def5678 100644
--- a/activesupport/lib/active_support/core_ext/module/attr_internal.rb
+++ b/activesupport/lib/active_support/core_ext/module/attr_internal.rb
@@ -27,7 +27,8 @@
def attr_internal_define(attr_name, type)
internal_name = attr_internal_ivar_name(attr_name).sub(/\A@/, '')
- class_eval do # class_eval is necessary on 1.9 or else the methods a made private
+ # class_eval is necessary on 1.9 or else the methods are made private
+ class_eval do
# use native attr_* methods as they are faster on some Ruby implementations
send("attr_#{type}", internal_name)
end
| Fix grammar of internal comment and modify it's location
|
diff --git a/lib/naught/null_class_builder/conversions_module.rb b/lib/naught/null_class_builder/conversions_module.rb
index abc1234..def5678 100644
--- a/lib/naught/null_class_builder/conversions_module.rb
+++ b/lib/naught/null_class_builder/conversions_module.rb
@@ -1,46 +1,57 @@ module Naught
class ConversionsModule < Module
+ attr_reader :null_class
+ attr_reader :null_equivs
+
def initialize(null_class, null_equivs)
+ @null_class = null_class
+ @null_equivs = null_equivs
+ mod = self
super() do
- define_method(:Null) do |object=:nothing_passed|
- case object
- when NullObjectTag then object
- when :nothing_passed, *null_equivs
- null_class.get(caller: caller(1))
- else raise ArgumentError, "#{object.inspect} is not null!"
- end
- end
-
- define_method(:Maybe) do |object=nil, &block|
- object = block ? block.call : object
- case object
- when NullObjectTag then object
- when *null_equivs
- null_class.get(caller: caller(1))
- else
- object
- end
- end
-
- define_method(:Just) do |object=nil, &block|
- object = block ? block.call : object
- case object
- when NullObjectTag, *null_equivs
- raise ArgumentError, "Null value: #{object.inspect}"
- else
- object
- end
- end
-
- define_method(:Actual) do |object=nil, &block|
- object = block ? block.call : object
- case object
- when NullObjectTag then nil
- else
- object
- end
+ %w[Null Maybe Just Actual].each do |method_name|
+ define_method(method_name, &mod.method(method_name))
end
end
end
+
+ def Null(object=:nothing_passed)
+ case object
+ when NullObjectTag then object
+ when :nothing_passed, *null_equivs
+ null_class.get(caller: caller(1))
+ else raise ArgumentError, "#{object.inspect} is not null!"
+ end
+ end
+
+ def Maybe(object=nil, &block)
+ object = block ? block.call : object
+ case object
+ when NullObjectTag then object
+ when *null_equivs
+ null_class.get(caller: caller(1))
+ else
+ object
+ end
+ end
+
+ def Just(object=nil, &block)
+ object = block ? block.call : object
+ case object
+ when NullObjectTag, *null_equivs
+ raise ArgumentError, "Null value: #{object.inspect}"
+ else
+ object
+ end
+ end
+
+ def Actual(object=nil, &block)
+ object = block ? block.call : object
+ case object
+ when NullObjectTag then nil
+ else
+ object
+ end
+ end
+
end
end
| Move definition of conversion functions out of module initializer.
|
diff --git a/lib/netsuite/records/customer_payment_apply_list.rb b/lib/netsuite/records/customer_payment_apply_list.rb
index abc1234..def5678 100644
--- a/lib/netsuite/records/customer_payment_apply_list.rb
+++ b/lib/netsuite/records/customer_payment_apply_list.rb
@@ -1,31 +1,12 @@ module NetSuite
module Records
- class CustomerPaymentApplyList
- include Support::Fields
+ class CustomerPaymentApplyList < Support::Sublist
include Namespaces::TranCust
- fields :apply
+ sublist :apply, CustomerPaymentApply
- def initialize(attributes = {})
- initialize_from_attributes_hash(attributes)
- end
+ alias :applies :apply
- def apply=(applies)
- case applies
- when Hash
- self.applies << CustomerPaymentApply.new(applies)
- when Array
- applies.each { |apply| self.applies << CustomerPaymentApply.new(apply) }
- end
- end
-
- def applies
- @applies ||= []
- end
-
- def to_record
- { "#{record_namespace}:apply" => applies.map(&:to_record) }
- end
end
end
end
| Refactor CustomerPaymentApplyList to use Support::Sublist
|
diff --git a/site-cookbooks/backup_restore/spec/recipes/default_spec.rb b/site-cookbooks/backup_restore/spec/recipes/default_spec.rb
index abc1234..def5678 100644
--- a/site-cookbooks/backup_restore/spec/recipes/default_spec.rb
+++ b/site-cookbooks/backup_restore/spec/recipes/default_spec.rb
@@ -0,0 +1,15 @@+require_relative '../spec_helper'
+
+describe 'backup_restore::setup' do
+ let(:chef_run) do
+ ChefSpec::Runner.new(
+ cookbook_path: %w(site-cookbooks cookbooks),
+ platform: 'centos',
+ version: '6.5'
+ ).converge(described_recipe)
+ end
+
+ it 'include setup' do
+ expect(chef_run).to include_recipe 'backup_restore::setup'
+ end
+end
| Add chef-spec for default recipe
|
diff --git a/lib/active_record_sharding/log_subscriber.rb b/lib/active_record_sharding/log_subscriber.rb
index abc1234..def5678 100644
--- a/lib/active_record_sharding/log_subscriber.rb
+++ b/lib/active_record_sharding/log_subscriber.rb
@@ -3,17 +3,18 @@ extend ActiveSupport::Concern
included do
- class << self
- end
+ alias_method_chain :sql, :shard
+ MAGENTA = "\e[35m"
+ CYAN = "\e[36m"
end
- def sql(event)
+ def sql_with_shard(event)
self.class.runtime += event.duration
return unless logger.debug?
payload = event.payload
- return if IGNORE_PAYLOAD_NAMES.include?(payload[:name])
+ return if ActiveRecord::LogSubscriber::IGNORE_PAYLOAD_NAMES.include?(payload[:name])
name = "#{payload[:name]} (#{event.duration.round(1)}ms)"
sql = payload[:sql]
@@ -37,9 +38,5 @@
debug " #{name} #{database} #{sql}#{binds}"
end
-
- module ClassMethods
-
- end
end
end
| Fix show connection name in log
|
diff --git a/lib/engineyard-serverside-adapter/version.rb b/lib/engineyard-serverside-adapter/version.rb
index abc1234..def5678 100644
--- a/lib/engineyard-serverside-adapter/version.rb
+++ b/lib/engineyard-serverside-adapter/version.rb
@@ -1,7 +1,7 @@ module EY
module Serverside
class Adapter
- VERSION = "2.2.3.pre"
+ VERSION = "2.3.0.pre"
end
end
end
| Bump to 2.3.0. Includes backwards compatible new features
|
diff --git a/config/initializers/aws.rb b/config/initializers/aws.rb
index abc1234..def5678 100644
--- a/config/initializers/aws.rb
+++ b/config/initializers/aws.rb
@@ -1,6 +1,6 @@ Rails.application.configure do
- config.sns_gcm_application_arn = ENV['SNS_GCM_ARN']
- config.sns_apn_application_arn = ENV['SNS_APN_ARN']
+ config.sns_gcm_application_arn = ENV['SNS_GCM_ARN'] | 'arn:aws:sns:us-west-2:813809418199:app/GCM/VITA-GCM'
+ config.sns_apn_application_arn = ENV['SNS_APN_ARN'] | 'arn:aws:sns:us-west-2:813809418199:app/APNS/VITA-APNS'
config.sns = Aws::SNS::Client.new(region: 'us-west-2')
if Rails.env.test?
| Include sensible defaults for the application arn values
|
diff --git a/app/features/photo/nil_photo.rb b/app/features/photo/nil_photo.rb
index abc1234..def5678 100644
--- a/app/features/photo/nil_photo.rb
+++ b/app/features/photo/nil_photo.rb
@@ -19,15 +19,7 @@ ''
end
- def insecure_url
- ''
- end
-
def secure_url
- ''
- end
-
- def thumb_url
''
end
| Remove unused attributes from NilPhoto
|
diff --git a/app/forms/claim_outcome_form.rb b/app/forms/claim_outcome_form.rb
index abc1234..def5678 100644
--- a/app/forms/claim_outcome_form.rb
+++ b/app/forms/claim_outcome_form.rb
@@ -1,8 +1,7 @@-class ClaimForm < Form
+class ClaimOutcomeForm < Form
attributes :desired_outcomes, :other_outcome
validates :other_outcome, length: { maximum: 2500 }
-
private def target
resource
| Update class name on claim outcome form
|
diff --git a/app/helpers/addresses_helper.rb b/app/helpers/addresses_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/addresses_helper.rb
+++ b/app/helpers/addresses_helper.rb
@@ -2,9 +2,9 @@ # formats an address in HTML
def format_address a, html = true
if html
- lt = '<'
- gt = '>'
- lb = '<br />'
+ lt = '<'.html_safe
+ gt = '>'.html_safe
+ lb = '<br />'.html_safe
else
lt = '<'
gt = '>'
| Mark format_address HTML as html_safe
|
diff --git a/TumblrSDK.podspec b/TumblrSDK.podspec
index abc1234..def5678 100644
--- a/TumblrSDK.podspec
+++ b/TumblrSDK.podspec
@@ -6,4 +6,5 @@ s.frameworks = 'Foundation'
s.dependency 'TumblrAuthentication', :git => "git@github.com:tumblr/tumblr-ios-authentication.git"
s.dependency 'JXHTTP', :git => "git@github.com:tumblr/JXHTTP.git"
+ s.dependency 'TumblrAppClient', :git => "git@github.com:tumblr/tumblr-ios-app-client.git"
end
| Add dependency on app client
|
diff --git a/BlocksKit.podspec b/BlocksKit.podspec
index abc1234..def5678 100644
--- a/BlocksKit.podspec
+++ b/BlocksKit.podspec
@@ -0,0 +1,23 @@+Pod::Spec.new do |s|
+ s.name = 'BlocksKit'
+ s.version = '0.9.5'
+ s.summary = 'The Objective-C block utilities you always wish you had.'
+ s.homepage = 'https://github.com/zwaldowski/BlocksKit'
+ s.author = { 'Zachary Waldowski' => 'zwaldowski@gmail.com'}
+ s.source = { :git => 'https://github.com/zwaldowski/BlocksKit.git', :tag => 'v0.9.5' }
+
+ s.source_files = 'BlocksKit'
+
+ s.frameworks = 'MessageUI'
+
+ s.requires_arc = true
+
+ s.clean_paths = 'BlocksKit.xcodeproj/', 'GHUnitIOS.framework/', 'Tests/', '.gitignore'
+
+ def s.post_install(target)
+ prefix_header = config.project_pods_root + target.prefix_header_filename
+ prefix_header.open('a') do |file|
+ file.puts(%{#ifdef __OBJC__\n#import <dispatch/dispatch.h>\n#import "BlocksKit.h"\n#endif})
+ end
+ end
+end
| Add updated CocoaPods spec for 0.9.5.
Signed-off-by: f6cb034ae1bf314d2c0261a7a22e4684d1f74b57@gmail.com <f6cb034ae1bf314d2c0261a7a22e4684d1f74b57@gmail.com> |
diff --git a/test/controllers/admin_controller_test.rb b/test/controllers/admin_controller_test.rb
index abc1234..def5678 100644
--- a/test/controllers/admin_controller_test.rb
+++ b/test/controllers/admin_controller_test.rb
@@ -11,13 +11,18 @@
test "should require admin privileges to view page" do
sign_out :user
- assert_raises ActionController::RoutingError do
- get :index
+
+ [:index, :users, :ignored_users, :flagged].each do |path|
+ assert_raises ActionController::RoutingError do
+ get path
+ end
end
sign_in users(:approved_user)
- assert_raises ActionController::RoutingError do
- get :index
+ [:index, :users, :ignored_users, :flagged].each do |path|
+ assert_raises ActionController::RoutingError do
+ get path
+ end
end
end
| Check authorization on all admin routes
|
diff --git a/Casks/qrfcview.rb b/Casks/qrfcview.rb
index abc1234..def5678 100644
--- a/Casks/qrfcview.rb
+++ b/Casks/qrfcview.rb
@@ -0,0 +1,10 @@+class Qrfcview < Cask
+ version '20121106'
+ sha256 '925cc6afc143f234a32e2f088cf3e4de6357e196edd38df30bc3f9b34074dccc'
+
+ url 'https://github.com/downloads/saghul/qrfcview-osx/qRFCView-20121106-1.dmg'
+ homepage 'https://saghul.github.io/qrfcview-osx'
+
+
+ link 'qRFCView.app'
+end
| Create cask for qRFCView v20121106
|
diff --git a/app/models/renalware/pathology/message_param_parser.rb b/app/models/renalware/pathology/message_param_parser.rb
index abc1234..def5678 100644
--- a/app/models/renalware/pathology/message_param_parser.rb
+++ b/app/models/renalware/pathology/message_param_parser.rb
@@ -4,24 +4,33 @@ module Pathology
class MessageParamParser
def parse(message_payload)
- params = {
+ request = message_payload.observation_request
+
+ observations_params = build_observations_params(request.observations)
+ build_observation_request_params(request, observations_params)
+ end
+
+ private
+
+ def build_observation_request_params(request, observations_params)
+ {
observation_request: {
- requestor_name: message_payload.observation_request.ordering_provider,
- pcs_code: message_payload.observation_request.placer_order_number,
- observed_at: Time.parse(message_payload.observation_request.date_time).to_s,
- observation_attributes: []
+ requestor_name: request.ordering_provider,
+ pcs_code: request.placer_order_number,
+ observed_at: Time.parse(request.date_time).to_s,
+ observation_attributes: observations_params
}
}
+ end
- message_payload.observation_request.observations.each do |observation|
- params[:observation_request][:observation_attributes] << {
+ def build_observations_params(observations)
+ observations.map do |observation|
+ {
observed_at: Time.parse(observation.date_time).to_s,
value: observation.value,
comment: observation.comment
}
end
-
- params
end
end
end
| Refactor to invention revealing methods |
diff --git a/Casks/telegram.rb b/Casks/telegram.rb
index abc1234..def5678 100644
--- a/Casks/telegram.rb
+++ b/Casks/telegram.rb
@@ -1,6 +1,6 @@ cask :v1 => 'telegram' do
- version '0.7.17'
- sha256 '8c724f209947f224b7fea4a88f56e8c54c593fd50b28455cebf6a3462f47d395'
+ version '0.8.3'
+ sha256 'e1ece44ceba78952f113759ad425cf9ebddae357fd6ca6eebd559195fadbc704'
# tdesktop.com is the official download host per the vendor homepage
url "https://updates.tdesktop.com/tmac/tsetup.#{version}.dmg"
| Update Telegram.app to 0.8.3
Updated sha256sum signature for tsetup.0.8.3.dmg
|
diff --git a/db/migrate/20140512131526_remove_option_id_from_questions.rb b/db/migrate/20140512131526_remove_option_id_from_questions.rb
index abc1234..def5678 100644
--- a/db/migrate/20140512131526_remove_option_id_from_questions.rb
+++ b/db/migrate/20140512131526_remove_option_id_from_questions.rb
@@ -8,8 +8,15 @@ end
class Tasuku::Taskables::Question::Vote < ActiveRecord::Base
+ self.table_name = 'tasks_taskables_question_votes'
belongs_to :option
belongs_to :answer
+ end
+
+ class Tasuku::Taskables::Question::Option < ActiveRecord::Base
+ self.table_name = 'tasks_taskables_question_options'
+ belongs_to :vote
+ belongs_to :option
end
def up
| Fix an issue that caused migrations to reference tables that don’t exist (yet) |
diff --git a/db/migrate/20180321094200_populate_full_approval_workflow.rb b/db/migrate/20180321094200_populate_full_approval_workflow.rb
index abc1234..def5678 100644
--- a/db/migrate/20180321094200_populate_full_approval_workflow.rb
+++ b/db/migrate/20180321094200_populate_full_approval_workflow.rb
@@ -1,6 +1,6 @@ class PopulateFullApprovalWorkflow < ActiveRecord::Migration[5.0]
- class MigrateableCase < ActiveRecord::Base
+ class Case::Base < ApplicationRecord
self.table_name = :cases
@@ -22,7 +22,7 @@ end
def up
- MigrateableCase.find_each do |kase|
+ Case::Base.find_each do |kase|
if kase.flagged_for_press_office_clearance?
kase.update(workflow: 'full_approval')
end
| Fix migration to re-use Case::Base
|
diff --git a/CoreHound.podspec b/CoreHound.podspec
index abc1234..def5678 100644
--- a/CoreHound.podspec
+++ b/CoreHound.podspec
@@ -20,6 +20,6 @@ s.dependency 'Avenue', '~> 0.3'
s.dependency 'AvenueFetcher', '~> 0.3'
s.dependency 'JSONModel', '~> 1.1'
- s.dependency 'PromiseKit/CorePromise', '~> 2.0'
+ s.dependency 'PromiseKit/CorePromise'
s.dependency 'UICKeyChainStore'
end
| Remove promisekit version dependency while PK is in flux with versioning
|
diff --git a/teaas.gemspec b/teaas.gemspec
index abc1234..def5678 100644
--- a/teaas.gemspec
+++ b/teaas.gemspec
@@ -1,6 +1,6 @@ Gem::Specification.new do |s|
s.name = 'teaas'
- s.version = '1.0.0.bacon'
+ s.version = '1.0.0'
s.licenses = ['MIT']
s.summary = "Total Emojis as a Service"
s.description = "Gem to manipulate emoji-sized images"
| Update gemspec to version 1.0.0
|
diff --git a/app/models/spree/adjustable/adjuster/bulk_discount.rb b/app/models/spree/adjustable/adjuster/bulk_discount.rb
index abc1234..def5678 100644
--- a/app/models/spree/adjustable/adjuster/bulk_discount.rb
+++ b/app/models/spree/adjustable/adjuster/bulk_discount.rb
@@ -17,9 +17,8 @@ end
def update_totals(bulk_discount_total)
- # we DO NOT update the adjustment_total since bulk_discount is registered as a competing_promo
- # this is also why we do not register this as a price modifier hook
@totals[:bulk_discount_total] = bulk_discount_total
+ @totals[:taxable_adjustment_total] += bulk_discount_total
end
end
end
| Add bulk discount to taxable adjustment total
|
diff --git a/spec/support/seed_helper.rb b/spec/support/seed_helper.rb
index abc1234..def5678 100644
--- a/spec/support/seed_helper.rb
+++ b/spec/support/seed_helper.rb
@@ -12,22 +12,28 @@ def create_bare_seeds
puts "Prepare seeds"
FileUtils.mkdir_p(SUPPORT_PATH)
- system(*%W(git clone --bare #{GITHUB_URL}), chdir: SUPPORT_PATH)
+ system(git_env, *%W(git clone --bare #{GITHUB_URL}), chdir: SUPPORT_PATH)
end
def create_normal_seeds
puts "Prepare seeds"
FileUtils.mkdir_p(SUPPORT_PATH)
- system(*%W(git clone #{TEST_REPO_PATH} #{TEST_NORMAL_REPO_PATH}))
+ system(git_env, *%W(git clone #{TEST_REPO_PATH} #{TEST_NORMAL_REPO_PATH}))
end
def create_mutable_seeds
puts 'Prepare seeds'
FileUtils.mkdir_p(SUPPORT_PATH)
- system(*%W(git clone #{TEST_REPO_PATH} #{TEST_MUTABLE_REPO_PATH}))
- system(*%w(git branch -t feature origin/feature),
+ system(git_env, *%W(git clone #{TEST_REPO_PATH} #{TEST_MUTABLE_REPO_PATH}))
+ system(git_env, *%w(git branch -t feature origin/feature),
chdir: TEST_MUTABLE_REPO_PATH)
- system(*%W(git remote add expendable #{GITHUB_URL}),
+ system(git_env, *%W(git remote add expendable #{GITHUB_URL}),
chdir: TEST_MUTABLE_REPO_PATH)
end
+
+ # Prevent developer git configurations from being persisted to test
+ # repositories
+ def git_env
+ {'GIT_TEMPLATE_DIR' => ''}
+ end
end
| Define GIT_TEMPLATE_DIR environment variable in seed helper
See https://github.com/gitlabhq/gitlabhq/pull/9044
|
diff --git a/beefcake.gemspec b/beefcake.gemspec
index abc1234..def5678 100644
--- a/beefcake.gemspec
+++ b/beefcake.gemspec
@@ -18,5 +18,5 @@ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]
- s.add_development_dependency('rake', '10.1.0')
+ s.add_development_dependency('rake', '~> 10.1.0')
end
| Make gemspec less picky about rake
|
diff --git a/Casks/xact.rb b/Casks/xact.rb
index abc1234..def5678 100644
--- a/Casks/xact.rb
+++ b/Casks/xact.rb
@@ -1,6 +1,6 @@ class Xact < Cask
- version '2.32'
- sha256 '645ff112b59fad2f344b16551472529b589a31d06cb620fb94c54cb453273fa2'
+ version '2.33'
+ sha256 'bd828a3ed879442bf76564fc97c117bee8d49bddabaf3c066413f3dd9e27d714'
url "http://xact.scottcbrown.org/xACT#{version}.zip"
appcast 'http://xactupdate.scottcbrown.org/xACT.xml'
| Update xACT 2.32 to 2.33
Update xACT 2.32 to 2.33 |
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
@@ -13,13 +13,15 @@ @username = user.username
@api_key = user.api_key
- h = attributes.symbolize_keys
- @service_account = h[:service_account]
- @bq_public_project = h[:bq_public_project]
- @gcp_execution_project = h[:gcp_execution_project]
- @bq_project = h[:bq_project]
- @bq_dataset = h[:bq_dataset]
- @gcs_bucket = h[:gcs_bucket]
+ if attributes.present?
+ h = attributes.symbolize_keys
+ @service_account = h[:service_account]
+ @bq_public_project = h[:bq_public_project]
+ @gcp_execution_project = h[:gcp_execution_project]
+ @bq_project = h[:bq_project]
+ @bq_dataset = h[:bq_dataset]
+ @gcs_bucket = h[:gcs_bucket]
+ end
end
def store
| Fix bug: do not try to populate from missing attributes
|
diff --git a/lib/chef/knife/secure_bag_show.rb b/lib/chef/knife/secure_bag_show.rb
index abc1234..def5678 100644
--- a/lib/chef/knife/secure_bag_show.rb
+++ b/lib/chef/knife/secure_bag_show.rb
@@ -9,6 +9,12 @@
banner "knife secure bag show BAG [ITEM] (options)"
category "secure bag"
+
+ option :encoded,
+ long: "--encoded",
+ boolean: true,
+ description: "Whether we wish to display encoded values",
+ default: false
def load_item(bag, item_name)
item = SecureDataBag::Item.load(
@@ -18,8 +24,8 @@ )
item.encoded_fields(encoded_fields)
- data = item.to_hash(encoded:false)
- data = data_for_edit(data)
+ data = item.to_hash(encoded:config[:encoded])
+ data = data_for_edit(data) unless config[:encoded]
data
end
| Update to allow knife show to display encoded values
|
diff --git a/Fetchable.podspec b/Fetchable.podspec
index abc1234..def5678 100644
--- a/Fetchable.podspec
+++ b/Fetchable.podspec
@@ -13,9 +13,9 @@ spec.platform = :ios, '6.0'
spec.source = { :git => 'https://github.com/phatblat/Fetchable.git',
- :branch => 'master'
- # :tag => "#{spec.version}"
- # :commit => 'fdaf35f17fd279397d1ae5a79db76afc8c841797'
+ :branch => 'master',
+ # :tag => spec.version.to_s,
+ # :commit => 'fdaf35f17fd279397d1ae5a79db76afc8c841797',
}
spec.source_files = 'Classes/**/*.{h,m}'
| Use :tag => spec.version.to_s in podspec
|
diff --git a/app/controllers/airports_controller.rb b/app/controllers/airports_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/airports_controller.rb
+++ b/app/controllers/airports_controller.rb
@@ -3,7 +3,8 @@ def search
if !params[:airport].blank?
@airports = Rails.cache.fetch("airport-search-#{params[:airport].gsub(/\W/,"-")}") do
- airports = Airport.find(:all, :conditions => "name LIKE '#{params[:airport]}%'")
+ query = "'#{params[:airport]}%'"
+ airports = Airport.find(:all, :conditions => "name LIKE :query OR country LIKE :query OR country LIKE :query OR iata_code LIKE :query")
airports.map{|airport| [:id => airport.id, :address => airport.display]}.flatten.to_json
end
render :json => @airports
| Add missing fields back into airport search
|
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,12 +1,14 @@ class CommentsController < ApplicationController
+ before_action :set_resource, only: [:index, :new, :create]
+
+ def index
+ end
def new
- @resource = Resource.find_by(id: params[:resource_id])
@comment = @resource.comments.build
end
def create
- @resource = Resource.find_by(id: params[:resource_id])
@comment = @resource.comments.build(comment_params)
@comment.user = current_user
if @resource.save
@@ -15,6 +17,9 @@ flash[:error] = @comment.errors.full_messages
redirect_to resource_path(@resource)
end
+ end
+
+ def edit
end
def destroy
@@ -26,6 +31,10 @@
private
+ def set_resource
+ @resource = Resource.find_by(id: params[:id])
+ end
+
def comment_params
params.require(:comment).permit(:content)
end
| Set resource for comments index, new, and create actions.
|
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
@@ -11,13 +11,12 @@ if user.activated?
log_in user
params[:session][:remember_me] == '1' ? remember(user) : forget(user)
- redirect_back_or user
else
message = "Account not activated. "
message += "Check your email for the activation link."
flash[:warning] = message
- redirect_to root_url
end
+ redirect_to root_url
else
flash.now[:danger] = 'Felaktigt lösenord/Email'
render 'new'
| Edit login route to root_url
|
diff --git a/app/models/spree/shipment_decorator.rb b/app/models/spree/shipment_decorator.rb
index abc1234..def5678 100644
--- a/app/models/spree/shipment_decorator.rb
+++ b/app/models/spree/shipment_decorator.rb
@@ -4,9 +4,45 @@ has_one :master_package, :class_name => 'Spree::Package'
accepts_nested_attributes_for :packages
+
+ StateMachine::Machine.ignore_method_conflicts = true
+ state_machines.clear
+
+ state_machine :initial => 'not_picked', :use_transactions => false do
+
+ event :picked do
+ transition :from => 'not_picked' , :to => 'picked'
+ end
+
+ event :packed do
+ transition :from => 'picked', :to => 'packed'
+ end
+
+ event :pending do
+ transition :from => 'packed', :to => 'pending'
+ end
+
+ event :ready do
+ transition :from => 'pending', :to => 'ready'
+ end
+
+ event :pend do
+ transition :from => 'ready', :to => 'pending'
+ end
+
+ event :ship do
+ transition :from => 'ready', :to => 'shipped'
+ end
+
+ after_transition :to => 'shipped', :do => :after_ship
+ end
+
def package
@package ||= self.packages.last
end
+
+
+
end
end | Change the state machine of Shipment
|
diff --git a/app/presenters/restaurant_presenter.rb b/app/presenters/restaurant_presenter.rb
index abc1234..def5678 100644
--- a/app/presenters/restaurant_presenter.rb
+++ b/app/presenters/restaurant_presenter.rb
@@ -12,18 +12,15 @@
def to_hash
{
- 'id' => restaurant.restaurant_id,
- 'name' => restaurant.name,
- 'address' => restaurant.address,
- 'city' => restaurant.city,
- 'state' => restaurant.state,
- 'area' => restaurant.metro_name,
- 'postal_code' => restaurant.postal_code,
- 'country' => restaurant.country,
- 'latitude' => restaurant.latitude,
- 'longitude' => restaurant.longitude,
- 'location' => [restaurant.latitude, restaurant.longitude],
- 'phone' => restaurant.phone,
+ 'id' => restaurant.restaurant_id,
+ 'name' => restaurant.name,
+ 'address' => restaurant.address,
+ 'city' => restaurant.city,
+ 'state' => restaurant.state,
+ 'area' => restaurant.metro_name,
+ 'postal_code' => restaurant.postal_code,
+ 'country' => restaurant.country,
+ 'phone' => restaurant.phone,
'reserve_url' => "http://www.opentable.com/single.aspx?rid=#{restaurant.restaurant_id}",
'mobile_reserve_url' => "http://mobile.opentable.com/opentable/?restId=#{restaurant.restaurant_id}",
}
| Remove location from presenter, not used
|
diff --git a/spec/factories/git_repositories.rb b/spec/factories/git_repositories.rb
index abc1234..def5678 100644
--- a/spec/factories/git_repositories.rb
+++ b/spec/factories/git_repositories.rb
@@ -2,7 +2,7 @@ factory :git_repository, class: Repository::GitRepository do
initialize_with do
# Open the repo that was cloned in git_revision_spec.rb
- GitRepository.open("#{::Rails.root}/data/test/repos/test_repo_workdir")
+ Repository::GitRepository.open("#{::Rails.root}/data/test/repos/test_repo_workdir")
end
end
end
| git: Fix failing test due to missing module
|
diff --git a/spec/features/events/index_spec.rb b/spec/features/events/index_spec.rb
index abc1234..def5678 100644
--- a/spec/features/events/index_spec.rb
+++ b/spec/features/events/index_spec.rb
@@ -3,22 +3,32 @@ describe 'Events index' do
let(:user) { FactoryGirl.create(:user) }
- before do
- confirm_and_sign_in user
- visit events_path
+ context 'signed in' do
+ before do
+ confirm_and_sign_in user
+ visit events_path
+ end
+
+ subject { page }
+
+ it { is_expected.to have_content 'Upcoming events' }
+ it { is_expected.to have_content 'No events found' }
+
+ context 'with events' do
+ before { 5.times { FactoryGirl.create(:event) } }
+
+ it 'should show all events' do
+ visit events_path
+ expect(subject).to have_selector('.event', count: 5)
+ end
+ end
end
- subject { page }
+ context 'not signed in' do
+ before { visit events_path }
- it { is_expected.to have_content 'Upcoming events' }
- it { is_expected.to have_content 'No events found' }
-
- context 'with events' do
- before { 5.times { FactoryGirl.create(:event) } }
-
- it 'should show all events' do
- visit events_path
- expect(subject).to have_selector('.event', count: 5)
+ it 'should require login' do
+ expect(current_path).to eql(new_user_session_path)
end
end
end
| Make sure Event show is tested for requiring login
|
diff --git a/spec/lib/ruby_gnuplot/plot_spec.rb b/spec/lib/ruby_gnuplot/plot_spec.rb
index abc1234..def5678 100644
--- a/spec/lib/ruby_gnuplot/plot_spec.rb
+++ b/spec/lib/ruby_gnuplot/plot_spec.rb
@@ -0,0 +1,32 @@+describe Gnuplot::Plot do
+ subject(:plot) { described_class.new }
+
+ describe '#to_gplot' do
+ context 'when nothing has been set' do
+ it "returns an empty string" do
+ expect(plot.to_gplot).to eq('')
+ end
+ end
+
+ context 'when titles and labels have been set' do
+ let(:expected_string) do
+ [
+ 'set title "Array Plot Example"',
+ 'set ylabel "x"',
+ 'set xlabel "x^2"',
+ ''
+ ].join("\n")
+ end
+
+ before do
+ plot.title "Array Plot Example"
+ plot.ylabel "x"
+ plot.xlabel "x^2"
+ end
+
+ it "sets title and axis labels" do
+ expect(plot.to_gplot).to eq(expected_string)
+ end
+ end
+ end
+end
| Add simple plot spec proposal
|
diff --git a/spec/support/capybara/driven_by.rb b/spec/support/capybara/driven_by.rb
index abc1234..def5678 100644
--- a/spec/support/capybara/driven_by.rb
+++ b/spec/support/capybara/driven_by.rb
@@ -4,7 +4,7 @@ config.before(:each, type: :system) do
# start a silenced Puma as application server
- Capybara.server = :puma, { Silent: true, Host: '0.0.0.0' }
+ Capybara.server = :puma, { Silent: true, Host: '0.0.0.0', Threads: '0:16' }
# set the Host from gather container IP for CI runs
if ENV['CI'].present?
| Enhancement: Increase number of Capybara puma threads from 4 to 16 to make tests more stable by handling more parallel requests.
|
diff --git a/examples/15_if_else.rb b/examples/15_if_else.rb
index abc1234..def5678 100644
--- a/examples/15_if_else.rb
+++ b/examples/15_if_else.rb
@@ -7,7 +7,7 @@ # end
#
-नसीब = [सच्चा, झूठा].फेंटो.पहलेवाला
+नसीब = [ सच्चा , झूठा ].फेंटो.पहलेवाला
अगर नसीब
छापो 'आप किस्मतवाले है!'
| Add space in keywords for detection |
diff --git a/RxAlamofire.podspec b/RxAlamofire.podspec
index abc1234..def5678 100644
--- a/RxAlamofire.podspec
+++ b/RxAlamofire.podspec
@@ -12,7 +12,7 @@ s.ios.deployment_target = "8.0"
s.osx.deployment_target = "10.10"
s.tvos.deployment_target = "9.0"
- s.watchos.deployment_target = "3.0"
+ s.watchos.deployment_target = "2.0"
s.requires_arc = true
| Revert "Watch OS deployment target to meet RxSwift"
This reverts commit 5bcdf321456f574d3c8510b486b9d85bf0c75387.
|
diff --git a/lib/omniauth/strategies/flickr.rb b/lib/omniauth/strategies/flickr.rb
index abc1234..def5678 100644
--- a/lib/omniauth/strategies/flickr.rb
+++ b/lib/omniauth/strategies/flickr.rb
@@ -4,7 +4,9 @@ module OmniAuth
module Strategies
class Flickr < OmniAuth::Strategies::OAuth
+
option :name, 'flickr'
+
option :client_options, {
:access_token_path => "/services/oauth/access_token",
:authorize_path => "/services/oauth/authorize",
@@ -17,15 +19,25 @@ }
info do
- {
- :username => access_token.params['username'],
- :full_name => access_token.params['fullname']
- }
+ user_info
end
extra do
{}
end
+
+ def user_info
+ if @user_info.blank?
+ @user_info = {}
+ # This is a public API and does not need signing or authentication
+ url = "/services/rest/?api_key=#{options.consumer_key}&format=json&method=flickr.people.getInfo&nojsoncallback=1&user_id=#{uid}"
+ response = Net::HTTP.get(options.client_options[:site].gsub(/.*:\/\//, ""), url)
+ @user_info ||= MultiJson.decode(response.body) if response
+ end
+ @user_info
+ rescue ::Errno::ETIMEDOUT
+ raise ::Timeout::Error
+ end
end
end
end
| Add rest of user info to info tag
|
diff --git a/db/migrate/20130119170218_add_geolocation_to_depots.rb b/db/migrate/20130119170218_add_geolocation_to_depots.rb
index abc1234..def5678 100644
--- a/db/migrate/20130119170218_add_geolocation_to_depots.rb
+++ b/db/migrate/20130119170218_add_geolocation_to_depots.rb
@@ -0,0 +1,6 @@+class AddGeolocationToDepots < ActiveRecord::Migration
+ def change
+ add_column :depots, :lat, :decimal, {:precision=>15, :scale=>10}
+ add_column :depots, :lng, :decimal, {:precision=>15, :scale=>10}
+ end
+end
| Add migration to add geolocation to depots.
|
diff --git a/haproxy_log_parser.gemspec b/haproxy_log_parser.gemspec
index abc1234..def5678 100644
--- a/haproxy_log_parser.gemspec
+++ b/haproxy_log_parser.gemspec
@@ -9,7 +9,7 @@
s.add_dependency 'treetop'
- s.add_development_dependency 'rspec'
+ s.add_development_dependency 'rspec', '~> 2.13'
s.files = Dir.glob('lib/**/*') + [
'README.rdoc',
| Change rspec version requirement to ~> 2.13
|
diff --git a/examples/percentage_of_actors_enabled_check.rb b/examples/percentage_of_actors_enabled_check.rb
index abc1234..def5678 100644
--- a/examples/percentage_of_actors_enabled_check.rb
+++ b/examples/percentage_of_actors_enabled_check.rb
@@ -0,0 +1,39 @@+require File.expand_path('../example_setup', __FILE__)
+
+require 'flipper'
+require 'flipper/adapters/memory'
+
+adapter = Flipper::Adapters::Memory.new
+flipper = Flipper.new(adapter)
+
+# Some class that represents what will be trying to do something
+class User
+ attr_reader :id
+
+ def initialize(id)
+ @id = id
+ end
+
+ # Must respond to flipper_id
+ alias_method :flipper_id, :id
+end
+
+# checking a bunch
+gate = Flipper::Gates::PercentageOfActors.new
+feature_name = "data_migration"
+percentage_enabled = 10
+total = 20_000
+enabled = []
+
+(1..total).each do |id|
+ user = User.new(id)
+ if gate.open?(user, percentage_enabled, feature_name: feature_name)
+ enabled << user
+ end
+end
+
+p actual: enabled.size, expected: total * (percentage_enabled * 0.01)
+
+# checking one
+user = User.new(1)
+p user_1_enabled: Flipper::Gates::PercentageOfActors.new.open?(user, percentage_enabled, feature_name: feature_name)
| Add percentage of actors enabled check example
|
diff --git a/LiveFrost.podspec b/LiveFrost.podspec
index abc1234..def5678 100644
--- a/LiveFrost.podspec
+++ b/LiveFrost.podspec
@@ -2,13 +2,13 @@ s.name = "LiveFrost"
s.version = "1.0.2"
s.summary = "Real time blurring."
- s.homepage = "http://github.com/radi/LiveFrost"
+ s.homepage = "https://github.com/radi/LiveFrost"
s.license = 'MIT'
s.author = {
"Evadne Wu" => "ev@radi.ws",
"Nicholas Gabriel Levin" => "nglevin@vivarium.gs"
}
- s.source = { :git => "git@github.com:radi/LiveFrost.git", :tag => "1.0.2" }
+ s.source = { :git => "https://github.com/radi/LiveFrost.git", :tag => "1.0.2" }
s.platform = :ios, '6.0'
s.source_files = 'LiveFrost', 'LiveFrost/**/*.{h,m}'
s.exclude_files = 'LiveFrost/Exclude'
| Use correct URLs in podspec
|
diff --git a/lib/miq_automation_engine/service_models/miq_ae_service_generic_object.rb b/lib/miq_automation_engine/service_models/miq_ae_service_generic_object.rb
index abc1234..def5678 100644
--- a/lib/miq_automation_engine/service_models/miq_ae_service_generic_object.rb
+++ b/lib/miq_automation_engine/service_models/miq_ae_service_generic_object.rb
@@ -27,7 +27,7 @@ end
def respond_to_missing?(method_name, include_private = false)
- @object.respond_to?(method_name, include_private)
+ object_send(:respond_to?, method_name, include_private)
end
end
end
| Use object_send instead of calling @object directly.
(transferred from ManageIQ/manageiq@048f1049dd6d6dd7d6bb57c7ea9ff663989950c5)
|
diff --git a/app/models/log.rb b/app/models/log.rb
index abc1234..def5678 100644
--- a/app/models/log.rb
+++ b/app/models/log.rb
@@ -1,2 +1,15 @@ class Log < ApplicationRecord
+ enum status: { "Draft" => 0, "Published" => 1 }
+ enum motivation: {
+ "😫" => 0,
+ "😖" => 1,
+ "😞" => 2,
+ "😕" => 3,
+ "🙄" => 4,
+ "😐" => 5,
+ "🤔" => 6,
+ "🙂" => 7,
+ "😉" => 8,
+ "😆" => 9
+ }
end
| Set up enums for Logs
|
diff --git a/Parsimmon.podspec b/Parsimmon.podspec
index abc1234..def5678 100644
--- a/Parsimmon.podspec
+++ b/Parsimmon.podspec
@@ -3,7 +3,7 @@ s.name = 'Parsimmon'
s.version = '0.1.0'
s.license = { :type => 'MIT' }
- s.homepage = 'http://wwww.parsimmon.com'
+ s.homepage = 'http://www.parsimmon.com'
s.summary = 'Linguistics toolkit for iOS'
s.requires_arc = true
| Fix broken URL in pod spec |
diff --git a/app/views/workflows/show.json.jbuilder b/app/views/workflows/show.json.jbuilder
index abc1234..def5678 100644
--- a/app/views/workflows/show.json.jbuilder
+++ b/app/views/workflows/show.json.jbuilder
@@ -9,7 +9,9 @@ json.set! 'type', Pathname(content).file? ? 'file' : 'dir'
json.set! 'fsurl', Filesystem.new.fs(content)
json.set! 'fs_base', Filesystem.new.fs(File.dirname(content))
- hostname = OODClusters[@workflow.batch_host].login.host if OODClusters[@workflow.batch_host] && OODClusters[@workflow.batch_host].login_allow?
+ if @workflow.batch_host
+ hostname = OODClusters[@workflow.batch_host].login.host if OODClusters[@workflow.batch_host] && OODClusters[@workflow.batch_host].login_allow?
+ end
json.set! 'terminal_base', OodAppkit.shell.url(path: File.dirname(content), host: hostname).to_s
json.set! 'apiurl', Filesystem.new.api(content)
json.set! 'editor_url', Filesystem.new.editor(content)
| Fix bug requesting data for workflow with unassigned batch host
|
diff --git a/app/helpers/items_helper.rb b/app/helpers/items_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/items_helper.rb
+++ b/app/helpers/items_helper.rb
@@ -24,7 +24,7 @@ # Channel-specific html
case item.channel_type
when 'youtube'
- tag(:iframe, src: "https://www.youtube.com/embed/#{item.guid}")
+ "<iframe width=\"640\" height=\"390\" src=\"https://www.youtube.com/embed/#{KSBKMrb-8KI}\" frameborder=\"0\" allowfullscreen></iframe>"
when 'instagram'
image_tag(item.assets.first.url)
else
| Fix bug where rails tag helper tried to make iFrame self-closing
|
diff --git a/app/models/local_service.rb b/app/models/local_service.rb
index abc1234..def5678 100644
--- a/app/models/local_service.rb
+++ b/app/models/local_service.rb
@@ -10,12 +10,17 @@
validates :lgsl_code, :providing_tier, presence: true
validates :lgsl_code, uniqueness: true
- validates :providing_tier,
- inclusion: {
- in: [%w[county unitary], %w[district unitary], %w[district unitary county]],
- }
+ validate :eligible_providing_tier
def self.find_by_lgsl_code(lgsl_code)
LocalService.where(lgsl_code: lgsl_code).first
end
+
+ def eligible_providing_tier
+ providing_tiers = [%w[county unitary], %w[district unitary], %w[district unitary county]]
+
+ return if providing_tiers.include?(providing_tier)
+
+ errors.add(:providing_tier, "Not in list")
+ end
end
| Fix validation after Rails bump
The use of `inclusion` `in:` stoppped recognising nested arrays, and
began to fail validation everytime an attempt to create a LocaleService
was made. I couldn't find an out of the box solution for this so have
added a simple custom validator.
|
diff --git a/spec/factories/educators.rb b/spec/factories/educators.rb
index abc1234..def5678 100644
--- a/spec/factories/educators.rb
+++ b/spec/factories/educators.rb
@@ -15,7 +15,7 @@ end
login_name do
last_name, first_name = full_name.split(', ')
- "#{first_name.first}#{last_name}"
+ "#{first_name}#{last_name}"
end
local_id { FactoryBot.generate(:staff_local_id) }
association :school
| Update Educator factory to use unique login_names to avoid collisions
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.