diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/spec/nessusdocument_spec.rb b/spec/nessusdocument_spec.rb index abc1234..def5678 100644 --- a/spec/nessusdocument_spec.rb +++ b/spec/nessusdocument_spec.rb @@ -1,6 +1,6 @@ require "spec_helper" -module NessusDB +module Risu describe NessusDocument do before(:all) do @doc = NessusDocument.new "test_data/nessus_report_local.nessus"
Rename from NessusDB to Risu
diff --git a/spec/requests/notes_spec.rb b/spec/requests/notes_spec.rb index abc1234..def5678 100644 --- a/spec/requests/notes_spec.rb +++ b/spec/requests/notes_spec.rb @@ -41,6 +41,21 @@ end + it "deletes a note from a story", :js => true do + FactoryGirl.create :note, :user => user, + :story => story, + :note => 'Delete me please' + + visit project_path(project) + + within('#in_progress .story') do + click_on 'Expand' + within('.notelist') do + click_on 'Delete' + end + end + find('#in_progress .story .notelist').should_not have_content('Delete me please') + end end end
Add request spec for deleting notes.
diff --git a/spec/rystrix/bucket_spec.rb b/spec/rystrix/bucket_spec.rb index abc1234..def5678 100644 --- a/spec/rystrix/bucket_spec.rb +++ b/spec/rystrix/bucket_spec.rb @@ -42,9 +42,9 @@ size = 10 par = 0.01 bucket = Rystrix::Bucket.new(size: size, par: par) - bucket.increment :success - bucket.increment :success - bucket.increment :success + 100.times do + bucket.increment :success + end sleep par * size expect(bucket.total.success).to eq(0) end
Update bucket test case for more strict
diff --git a/lib/netsuite/records/time_bill.rb b/lib/netsuite/records/time_bill.rb index abc1234..def5678 100644 --- a/lib/netsuite/records/time_bill.rb +++ b/lib/netsuite/records/time_bill.rb @@ -10,13 +10,13 @@ actions :get, :get_list, :add, :delete, :search, :update, :upsert fields :created_date, :is_billable, :last_modified_date, :memo, :override_rate, :paid_externally, :rate, :status, - :supervisor_approval, :tran_date + :supervisor_approval, :tran_date, :time_type field :custom_field_list, CustomFieldList field :hours, Duration - record_refs :case_task_event, :class, :customer, :custom_form, :department, :employee, :item, :location, :payroll_item, - :price, :subsidiary, :temporary_local_jurisdiction, :temporary_state_jurisdiction, :workplace + record_refs :employee, :customer, :case_task_event, :payroll_item, :workplace, :item, :department, :location, :price, + :subsidiary, :temporary_local_jurisdiction, :temporary_state_jurisdiction attr_reader :internal_id attr_accessor :external_id
Remove :class record_ref to fix issue where it was erroring out.
diff --git a/integration-tests/apps/rails4/basic/config/application.rb b/integration-tests/apps/rails4/basic/config/application.rb index abc1234..def5678 100644 --- a/integration-tests/apps/rails4/basic/config/application.rb +++ b/integration-tests/apps/rails4/basic/config/application.rb @@ -1,10 +1,3 @@-# workaround JRuby 1.7.4 bug and Rails 2.0 in the Struct.to_h impl -class Struct # :nodoc: - def to_h - Hash[members.zip(values)] - end -end - require File.expand_path('../boot', __FILE__) require 'rails/all'
Remove JRuby 1.7.4 / Rails 4 workaround since we're on JRuby 1.7.8
diff --git a/spec/acceptance/support/javascript.rb b/spec/acceptance/support/javascript.rb index abc1234..def5678 100644 --- a/spec/acceptance/support/javascript.rb +++ b/spec/acceptance/support/javascript.rb @@ -1,4 +1,6 @@ RSpec.configure do |config| + javascript_driver = defined?(JRUBY_VERSION) ? :celerity : :selenium + config.filter_run :js_advanced => lambda { |val| !val or defined?(JRUBY_VERSION) } @@ -10,7 +12,7 @@ config.before(:each) do if example.metadata[:js] - Capybara.current_driver = :selenium + Capybara.current_driver = javascript_driver DatabaseCleaner.strategy = :truncation else DatabaseCleaner.strategy = :transaction
Use celerity within capybara if running on jruby.
diff --git a/lib/generators/grape_swagger/install/install_generator.rb b/lib/generators/grape_swagger/install/install_generator.rb index abc1234..def5678 100644 --- a/lib/generators/grape_swagger/install/install_generator.rb +++ b/lib/generators/grape_swagger/install/install_generator.rb @@ -10,7 +10,7 @@ def install install_path = 'apidoc' - swagger_ui_repo = 'https://github.com/wordnik/swagger-ui/' + swagger_ui_repo = 'https://github.com/wordnik/swagger-ui' api_path = 'api' Zip::ZipFile.foreach(open("#{swagger_ui_repo}/archive/master.zip")) do |zip_entry|
Fix swagger ui repo url
diff --git a/lib/ok_computer/legacy_rails_controller_support.rb b/lib/ok_computer/legacy_rails_controller_support.rb index abc1234..def5678 100644 --- a/lib/ok_computer/legacy_rails_controller_support.rb +++ b/lib/ok_computer/legacy_rails_controller_support.rb @@ -10,10 +10,9 @@ end # Support 'render plain' for Rails 3 - def render(*args, &block) - args = args[0] # Always an options hash - args[:text] = args.delete(:plain) if args.include?(:plain) - super(args, block) + def render(**options, &block) + options[:text] = options.delete(:plain) if options.include?(:plain) + super end end end
Use 2.0+ kwarg signature for 'render' Because hey, we only support Ruby 2 anyway.
diff --git a/numbers.rb b/numbers.rb index abc1234..def5678 100644 --- a/numbers.rb +++ b/numbers.rb @@ -10,7 +10,7 @@ IfZero = -> if_this_is_zero { -> do_this { -> otherwise_do_this { - IsZero[if_this_is_zero][->_{do_this.(Noop)}][->_{otherwise_do_this.(Noop)}].(Noop) + IsZero[if_this_is_zero][do_this][otherwise_do_this].(Noop) }}}
Remove deferring of branches in IfZero, as caller needs to do this
diff --git a/redis.gemspec b/redis.gemspec index abc1234..def5678 100644 --- a/redis.gemspec +++ b/redis.gemspec @@ -30,8 +30,7 @@ s.email = ["redis-db@googlegroups.com"] - s.files = `git ls-files`.split("\n") - s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") + s.files = Dir["CHANGELOG.md", "LICENSE", "README.md", "lib/**/*"] s.executables = `git ls-files -- exe/*`.split("\n").map{ |f| File.basename(f) } s.required_ruby_version = '>= 2.2.2'
Exclude test files from bundled gem
diff --git a/spec/features/about_us_spec.rb b/spec/features/about_us_spec.rb index abc1234..def5678 100644 --- a/spec/features/about_us_spec.rb +++ b/spec/features/about_us_spec.rb @@ -0,0 +1,22 @@+require "spec_helper" + +feature "About BigCo modal" do + scenario "toggles display of the modal about display", js: true do + visit root_path + + expect(page).to_not have_content "About BigCo" + expect(page).to_not have_content "BigCo produces the finest widgets in all the land" + + click_link "About Us" + + expect(page).to have_content "About BigCo" + expect(page).to have_content "BigCo produces the finest widgets in all the land" + + within "#about_us" do + click_button "Close" + end + + expect(page).to_not have_content "About BigCo" + expect(page).to_not have_content "BigCo produces the finest widgets in all the land" + end +end
Write feature spec of modal
diff --git a/spec/features/snippets_spec.rb b/spec/features/snippets_spec.rb index abc1234..def5678 100644 --- a/spec/features/snippets_spec.rb +++ b/spec/features/snippets_spec.rb @@ -7,8 +7,8 @@ scenario "user creates a new snippet" do snippet = FactoryBot.create(:snippet) visit '/' - fill_in "Title", with: snippet.title - fill_in "Body", with: snippet.body + fill_in "title", with: snippet.title + fill_in "body", with: snippet.body click_button "Add snippet" expect(page).to have_content "Snippet titled \"#{snippet.title}\" saved!" end
Fix wrong reference to form field
diff --git a/spec/lib/angellist_api_spec.rb b/spec/lib/angellist_api_spec.rb index abc1234..def5678 100644 --- a/spec/lib/angellist_api_spec.rb +++ b/spec/lib/angellist_api_spec.rb @@ -0,0 +1,38 @@+require 'spec_helper' + +describe AngellistApi do + + describe "#new" do + it "should be an alias for AngellistApi::Client.new" do + options = { :some => "option" } + AngellistApi.new(options).class.name.should == "AngellistApi::Client" + end + end + + describe "#method_missing" do + context "with a method known to AngellistApi::Client" do + it "should pass the method call to AngellistApi::Client" do + expected_result = {:some => "result"} + AngellistApi::Client.any_instance.expects(:startup_search).returns(expected_result) + lambda { AngellistApi.startup_search(:slug => 'angellist').should == expected_result }.should_not raise_error + end + end + + context "with a method unknown to AngellistApi::Client" do + it "should raise method not found error" do + lambda { AngellistApi.some_unknown_method }.should raise_error(NoMethodError) + end + end + end + + describe "#respond_to?" do + it "should return true if AngellistApi::Client responds to the method" do + AngellistApi.respond_to?(:startup_search).should be_true + end + + it "should return false if AngellistApi::Client does not respond to the method" do + AngellistApi.respond_to?(:some_unknown_method).should be_false + end + end + +end
Write tests for AngellistApi module
diff --git a/spec/meal_planner/meal_spec.rb b/spec/meal_planner/meal_spec.rb index abc1234..def5678 100644 --- a/spec/meal_planner/meal_spec.rb +++ b/spec/meal_planner/meal_spec.rb @@ -18,4 +18,18 @@ it "has a string representation" do @meal.to_s.should == "Main Dish: #{@main_dish}, Typical Time: #{@typical_time}" end + + context "suggested sides have been added" do + before do + @main_dish = "Hashed Browns" + @typical_time = "Dinner" + @meal = Meal.new(@main_dish, @typical_time) + + @side1 = Recipe.new("Bacon") + @meal.add_suggested_side(@side1) + end + + it "has a suggested side" + + end end
Add test for suggested sides in a meal
diff --git a/spec/support/request_helper.rb b/spec/support/request_helper.rb index abc1234..def5678 100644 --- a/spec/support/request_helper.rb +++ b/spec/support/request_helper.rb @@ -8,8 +8,9 @@ def authorized_preflight_headers { - 'HTTP_ACCESS_CONTROL_REQUEST_HEADERS' => 'accept, authorization, origin', + 'HTTP_ACCESS_CONTROL_REQUEST_HEADER' => 'accept, authorization, origin', 'HTTP_ACCESS_CONTROL_REQUEST_METHOD' => 'GET', + 'ORIGIN' => 'http://otherdomain.test/' } end end
Add origin head to tests Origin header value must be different from server domain
diff --git a/spec/integration/batch_delivery_spec.rb b/spec/integration/batch_delivery_spec.rb index abc1234..def5678 100644 --- a/spec/integration/batch_delivery_spec.rb +++ b/spec/integration/batch_delivery_spec.rb @@ -0,0 +1,14 @@+require 'spec_helper' + +describe 'Delivering emails in batches' do + let(:api_client) { Postmark::ApiClient.new('POSTMARK_API_TEST') } + let(:messages) { [TestMailer.simple_message, + TestMailer.tagged_message, + TestMailer.multipart_message, + TestMailer.message_with_attachment] } + + it 'delivers messages in batches' do + expect { api_client.deliver_messages(messages) }. + to change{messages.all? { |m| m.delivered?} }.to true + end +end
Add an integration test for delivery in batches.
diff --git a/opal/clearwater.rb b/opal/clearwater.rb index abc1234..def5678 100644 --- a/opal/clearwater.rb +++ b/opal/clearwater.rb @@ -1,4 +1,5 @@ require 'browser' require 'clearwater/component' +require 'clearwater/svg_component' require 'clearwater/link' require 'clearwater/application'
Include SVGComponent support by default It's not a big file, so it won't increase payload size by much.
diff --git a/spec/views/spree/orders/edit.html.haml_spec.rb b/spec/views/spree/orders/edit.html.haml_spec.rb index abc1234..def5678 100644 --- a/spec/views/spree/orders/edit.html.haml_spec.rb +++ b/spec/views/spree/orders/edit.html.haml_spec.rb @@ -0,0 +1,34 @@+# frozen_string_literal: true + +require "spec_helper" + +describe "spree/orders/edit.html.haml" do + let(:order) { create(:completed_order_with_fees) } + + before do + assign(:order, order) + assign(:insufficient_stock_lines, []) + allow(view).to receive_messages( + order: order, + current_order: order, + pickup_time: 'time', + spree_current_user: create(:user), + ) + end + + describe "unit prices" do + it "displays unit prices informations if feature toggle is activated" do + allow(OpenFoodNetwork::FeatureToggle) + .to receive(:enabled?).with(:unit_price, anything) { true } + render + expect(rendered).to have_selector(".unit-price") + end + + it "not displays unit prices informations if feature toggle is desactivated" do + allow(OpenFoodNetwork::FeatureToggle) + .to receive(:enabled?).with(:unit_price, anything) { false } + render + expect(rendered).not_to have_selector(".unit-price") + end + end +end
Add unit test for cart page
diff --git a/0_code_wars/pair_zeros.rb b/0_code_wars/pair_zeros.rb index abc1234..def5678 100644 --- a/0_code_wars/pair_zeros.rb +++ b/0_code_wars/pair_zeros.rb @@ -0,0 +1,14 @@+# http://www.codewars.com/kata/54e2213f13d73eb9de0006d2/ +# --- iteration 1 --- +def pair_zeros(arr) + zero_count = 0 + arr.map do |i| + zero_count += 1 if i == 0 + if zero_count == 2 + zero_count = 0 + nil + else + i + end + end.compact +end
Add code wars (7) - pair zeros
diff --git a/spec/rails/active_record/tracer_spec.rb b/spec/rails/active_record/tracer_spec.rb index abc1234..def5678 100644 --- a/spec/rails/active_record/tracer_spec.rb +++ b/spec/rails/active_record/tracer_spec.rb @@ -0,0 +1,48 @@+require "spec_helper" + +RSpec.describe ActiveRecord::Tracer do + let(:tracer) { Test::Tracer.new } + + describe "auto-instrumentation" do + before do + @active_record_tracer = ActiveRecord::Tracer.instrument(tracer: tracer) + Article.first + end + + after do + ActiveSupport::Notifications.unsubscribe(@active_record_tracer) + end + + it "creates a new span" do + expect(tracer.finished_spans).not_to be_empty + end + + it "sets operation_name to event's name" do + expect(tracer.finished_spans.first.operation_name).to eq("Article Load") + end + + it "propagates context" do + end + + it "sets standard OT tags" do + tags = tracer.finished_spans.first.tags + [ + ['component', 'ActiveRecord'], + ['span.kind', 'client'] + ].each do |key, value| + expect(tags[key]).to eq(value), "expected tag '#{key}' value to equal '#{value}', got '#{tags[key]}'" + end + end + + it "sets database specific OT tags" do + tags = tracer.finished_spans.first.tags + [ + ['db.type', 'sql'], + ['db.vendor', 'sqlite3'], + ['db.statement', 'SELECT "articles".* FROM "articles" ORDER BY "articles"."id" ASC LIMIT ?'], + ].each do |key, value| + expect(tags[key]).to eq(value), "expected tag '#{key}' value to equal '#{value}', got #{tags[key]}" + end + end + end +end
Add tests for ActiveRecord::Tracer auto-instrumentation
diff --git a/lib/sandthorn_driver_sequel/event_store_context.rb b/lib/sandthorn_driver_sequel/event_store_context.rb index abc1234..def5678 100644 --- a/lib/sandthorn_driver_sequel/event_store_context.rb +++ b/lib/sandthorn_driver_sequel/event_store_context.rb @@ -1,5 +1,6 @@ module SandthornDriverSequel module EventStoreContext + attr_reader :context def events_table_name with_context_if_exists :events end
Add context accessor to EventStoreContext
diff --git a/spec/unit/facts/rabbitmq_erlang_cookie_spec.rb b/spec/unit/facts/rabbitmq_erlang_cookie_spec.rb index abc1234..def5678 100644 --- a/spec/unit/facts/rabbitmq_erlang_cookie_spec.rb +++ b/spec/unit/facts/rabbitmq_erlang_cookie_spec.rb @@ -0,0 +1,19 @@+require 'spec_helper' + +describe 'rabbitmq_erlang_cookie', :type => :fact do + before(:each) { Facter.clear } + + it 'works correctly' do + Facter.fact(:osfamily).stubs(:value).returns('RedHat') + File.stubs(:exists?).with('/var/lib/rabbitmq/.erlang.cookie').returns(true) + File.stubs(:read).with('/var/lib/rabbitmq/.erlang.cookie').returns('THISISACOOKIE') + Facter.fact(:rabbitmq_erlang_cookie).value.should == 'THISISACOOKIE' + end + + it 'fails if file doesnt exist' do + Facter.fact(:osfamily).stubs(:value).returns('RedHat') + File.stubs(:exists?).with('/var/lib/rabbitmq/.erlang.cookie').returns(false) + Facter.fact(:rabbitmq_erlang_cookie).value.should == nil + end + +end
Add tests for this fact.
diff --git a/A2DynamicDelegate.podspec b/A2DynamicDelegate.podspec index abc1234..def5678 100644 --- a/A2DynamicDelegate.podspec +++ b/A2DynamicDelegate.podspec @@ -7,7 +7,14 @@ s.author = { 'Alexsander Akers' => 'a2@pandamonia.us', 'Zachary Waldowski' => 'zwaldowski@gmail.com' } s.source = { :git => 'https://github.com/pandamonia/A2DynamicDelegate.git', :tag => 'v2.0' } - s.dependency 'libffi' s.source_files = 'A2DynamicDelegate.{h,m}', 'A2BlockDelegate.{h,m}', 'A2BlockClosure.{h,m}', 'blockimp/*.{h,m,s}', 'libffi/*.h' - s.clean_paths = 'Demo/', 'A2DynamicDelegate.xcodeproj/', '.gitignore', 'libffi/' + s.clean_paths = 'Demo/', 'A2DynamicDelegate.xcodeproj/', '.gitignore' + s.xcconfig = { 'LIBRARY_SEARCH_PATHS' => "$(SRCROOT)/Pods/A2DynamicDelegate/libffi/", + 'HEADER_SEARCH_PATHS' => "$(SRCROOT)/Pods/A2DynamicDelegate/libffi/", + 'OTHER_LDFLAGS' => "-Wl,-no_compact_unwind" } + if config.ios? + s.library = 'ffi_ios' + else + s.library = 'ffi_mac' + end end
Revert part of "Project and pod spec updates." This reverts part of commit a8076d266a475bf9a12616b3395249eb408398f8. Signed-off-by: Zachary Waldowski <f6cb034ae1bf314d2c0261a7a22e4684d1f74b57@gmail.com>
diff --git a/perpetuity.gemspec b/perpetuity.gemspec index abc1234..def5678 100644 --- a/perpetuity.gemspec +++ b/perpetuity.gemspec @@ -10,6 +10,7 @@ s.homepage = "https://github.com/jgaskins/perpetuity.git" s.summary = %q{Persistence library allowing serialization of Ruby objects} s.description = %q{Persistence layer for Ruby objects} + s.license = 'MIT' s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
Add MIT license to gemspec
diff --git a/rails.gemspec b/rails.gemspec index abc1234..def5678 100644 --- a/rails.gemspec +++ b/rails.gemspec @@ -25,5 +25,5 @@ s.add_dependency('activeresource', version) s.add_dependency('actionmailer', version) s.add_dependency('railties', version) - s.add_dependency('bundler', '>= 1.0.0.beta.10') + s.add_dependency('bundler', '>= 1.0.0.rc.1') end
Make Rails 3 RC depend on Bundler RC
diff --git a/Casks/eclipse-modeling.rb b/Casks/eclipse-modeling.rb index abc1234..def5678 100644 --- a/Casks/eclipse-modeling.rb +++ b/Casks/eclipse-modeling.rb @@ -0,0 +1,16 @@+cask :v1 => 'eclipse-modeling' do + version '4.4.1' + + if Hardware::CPU.is_32_bit? + sha256 'df00541d1291c9f4dda6917ec8f07f22b1cad645f9641be53d9988a86528099d' + url 'http://download.eclipse.org/technology/epp/downloads/release/luna/SR1/eclipse-modeling-luna-SR1-macosx-cocoa.tar.gz' + else + sha256 'ad09c657dd1795eee42f1940473ce389168f819ecff7ea022ae0b9517e37f7be' + url 'http://download.eclipse.org/technology/epp/downloads/release/luna/SR1/eclipse-modeling-luna-SR1-macosx-cocoa-x86_64.tar.gz' + end + + homepage 'http://eclipse.org/' + license :oss + + app 'eclipse/eclipse.app' +end
Add Eclipse Modeling, version 4.4.1
diff --git a/db/migrate/20151108001401_add_entity_siret.rb b/db/migrate/20151108001401_add_entity_siret.rb index abc1234..def5678 100644 --- a/db/migrate/20151108001401_add_entity_siret.rb +++ b/db/migrate/20151108001401_add_entity_siret.rb @@ -1,4 +1,4 @@-class AddSiretAndShapeSupports < ActiveRecord::Migration +class AddEntitySiret < ActiveRecord::Migration def change rename_column :entities, :siren, :siret reversible do |d|
Rename invalid migration class name
diff --git a/IRC/IRCPlugin.rb b/IRC/IRCPlugin.rb index abc1234..def5678 100644 --- a/IRC/IRCPlugin.rb +++ b/IRC/IRCPlugin.rb @@ -25,7 +25,7 @@ def afterLoad; end # Called by the plugin manager before the plugin is unloaded. - # If this method returns anthing other than nil or false, the plugin + # If this method returns anything other than nil or false, the plugin # will not be unloaded and its return value will be displayed in the log. def beforeUnload; end
Fix typo in a comment
diff --git a/knife-azure.gemspec b/knife-azure.gemspec index abc1234..def5678 100644 --- a/knife-azure.gemspec +++ b/knife-azure.gemspec @@ -17,10 +17,11 @@ s.files = %w(LICENSE README.md) + Dir.glob("lib/**/*") s.homepage = "http://github.com/opscode/knife-azure" s.require_paths = ["lib"] - s.add_dependency(%q<nokogiri>,[">= 1.5.5"]) - s.add_dependency(%q<knife-windows>,[">= 0.5.14"]) - s.add_development_dependency(%q<chef>, [">= 11.8.2"]) - s.add_development_dependency(%q<mixlib-config>, ["~> 2.0"]) - s.add_development_dependency(%q<equivalent-xml>, ["~> 0.2.9"]) + s.add_dependency "nokogiri", ">= 1.5.5" + s.add_dependency "knife-windows", ">= 0.5.14" + + s.add_development_dependency "chef", ">= 11.8.2" + s.add_development_dependency "mixlib-config", "~> 2.0" + s.add_development_dependency "equivalent-xml", "~> 0.2.9" end
[KNIFE-472] Remove %q syntax to stop Lamont's eyes from bleeding
diff --git a/lib/honeydew/dsl.rb b/lib/honeydew/dsl.rb index abc1234..def5678 100644 --- a/lib/honeydew/dsl.rb +++ b/lib/honeydew/dsl.rb @@ -7,5 +7,11 @@ end EOF end + + def use_default_device(name) + define_singleton_method name.to_sym do |*args, &block| + Honeydew.using_device(Honeydew.default_device_serial, &block) + end + end end end
Allow use of default device in DSL
diff --git a/auth/app/controllers/spree/user_passwords_controller.rb b/auth/app/controllers/spree/user_passwords_controller.rb index abc1234..def5678 100644 --- a/auth/app/controllers/spree/user_passwords_controller.rb +++ b/auth/app/controllers/spree/user_passwords_controller.rb @@ -23,7 +23,7 @@ set_flash_message(:notice, :send_instructions) if is_navigational_format? respond_with resource, :location => spree.login_path else - respond_with_navigational(resource){ render_with_scope :new } + respond_with_navigational(resource) { render :new } end end
Remove one more occurrence of render_with_scope
diff --git a/r2.gemspec b/r2.gemspec index abc1234..def5678 100644 --- a/r2.gemspec +++ b/r2.gemspec @@ -10,7 +10,7 @@ s.email = ["matt@twitter.com"] s.homepage = "" s.summary = %q{CSS flipper for right-to-left processing} - s.description = %q{A Ruby port of https://github.com/ded/r2} + s.description = %q{CSS flipper for right-to-left processing. A Ruby port of https://github.com/ded/r2} s.rubyforge_project = "r2"
Fix some gem description details
diff --git a/GradientLayerView.podspec b/GradientLayerView.podspec index abc1234..def5678 100644 --- a/GradientLayerView.podspec +++ b/GradientLayerView.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'GradientLayerView' - s.version = '0.0.3' + s.version = '0.0.4' s.license = 'MIT' s.summary = 'The GradientView is a simple UIView with a CAGradientLayer, forwarding its properties up' s.homepage = 'https://github.com/nuudles/GradientView'
Update podspec version to 0.0.4
diff --git a/spec/ups/builders/ship_confirm_builder_spec.rb b/spec/ups/builders/ship_confirm_builder_spec.rb index abc1234..def5678 100644 --- a/spec/ups/builders/ship_confirm_builder_spec.rb +++ b/spec/ups/builders/ship_confirm_builder_spec.rb @@ -18,6 +18,7 @@ ship_confirm_builder.add_ship_from shipper ship_confirm_builder.add_package package ship_confirm_builder.add_label_specification 'gif', { height: '100', width: '100' } + ship_confirm_builder.add_description 'Los Pollo Hermanos' end it "should generate a valid XML Request" do
Add Description to ShipConfirm Request tests
diff --git a/lib/redmine_s3/attachment_patch.rb b/lib/redmine_s3/attachment_patch.rb index abc1234..def5678 100644 --- a/lib/redmine_s3/attachment_patch.rb +++ b/lib/redmine_s3/attachment_patch.rb @@ -20,7 +20,8 @@ def put_to_s3 if @temp_file && (@temp_file.size > 0) logger.debug("Uploading to #{disk_filename}") - RedmineS3::Connection.put(disk_filename, @temp_file.read) + content = @temp_file.respond_to?(:read) ? @temp_file.read : @temp_file + RedmineS3::Connection.put(disk_filename, content) md5 = Digest::MD5.new self.digest = md5.hexdigest end
Fix put_to_S3 when temp_file do not respond_to :read
diff --git a/lib/feed2email.rb b/lib/feed2email.rb index abc1234..def5678 100644 --- a/lib/feed2email.rb +++ b/lib/feed2email.rb @@ -6,7 +6,8 @@ end def self.logger - @logger ||= Logger.new(config['log_path'], config['log_level']) + @logger ||= Logger.new(config['log_path'], config['log_level'], + config['log_shift_age'], config['log_shift_size']) end def self.log(*args)
Add forgotten arguments to Logger.new
diff --git a/lib/fezzik/dsl.rb b/lib/fezzik/dsl.rb index abc1234..def5678 100644 --- a/lib/fezzik/dsl.rb +++ b/lib/fezzik/dsl.rb @@ -1,5 +1,12 @@ module Fezzik module DSL + # This is necessary to override Rake::RemoteTasks's globally eval'ed method definitions. + def self.included(klass) + klass.class_eval do + def role(*args) Fezzik.role(*args) end + def remote_task(*args, &block) Fezzik.remote_task(*args, &block) end + end + end def destination(name, &block) Fezzik.destination(name, &block) end def env(*args) Fezzik.env(*args) end def capture_output(&block) Fezzik::Util.capture_output(&block) end
Add DSLs for custom 'role' and 'remote_task' methods
diff --git a/lib/git_pissed.rb b/lib/git_pissed.rb index abc1234..def5678 100644 --- a/lib/git_pissed.rb +++ b/lib/git_pissed.rb @@ -13,6 +13,5 @@ shit fuck love - todo ).freeze end
Remove 'todo' as default word
diff --git a/lib/lobber/cli.rb b/lib/lobber/cli.rb index abc1234..def5678 100644 --- a/lib/lobber/cli.rb +++ b/lib/lobber/cli.rb @@ -5,7 +5,9 @@ default_task :lob desc "DIRECTORY", "Upload a directory to Amazon S3" - option :bucket + method_option :bucket, type: :string + method_option :dry_run, default: false, type: :boolean + method_option :verbose, default: true, type: :boolean def lob(directory = nil) return usage unless directory
Add method_options for dry-run and verbose
diff --git a/restore.gemspec b/restore.gemspec index abc1234..def5678 100644 --- a/restore.gemspec +++ b/restore.gemspec @@ -8,8 +8,8 @@ spec.version = Restore::VERSION spec.authors = ["re5et"] spec.email = ["re5etsmyth@gmail.com"] - spec.description = %q{TODO: Write a gem description} - spec.summary = %q{TODO: Write a gem summary} + spec.description = %q{Restore database backups} + spec.summary = %q{Restore and process database backups} spec.homepage = "" spec.license = "MIT"
Add gemspec description and summary
diff --git a/lib/tw-formula.rb b/lib/tw-formula.rb index abc1234..def5678 100644 --- a/lib/tw-formula.rb +++ b/lib/tw-formula.rb @@ -3,20 +3,21 @@ # changes in the future. TW_DEPLOYMENT_TARGET = "10.9" - # Keep track if we already augmented :install from formula. - @tw_install_patched = FALSE + # Keeps track if we already augmented :install from formula. + @tw_install_patched = false - # Inject additional dependencies and stuff. - def self.inherited subclass - subclass.__send__ :keg_only, "TeXworks build dependency." - subclass.__send__ :depends_on, :macos => :mavericks + # Injects additional dependencies and stuff. + def self.inherited(subclass) + subclass.__send__(:keg_only, "TeXworks build dependency.") + subclass.__send__(:depends_on, :macos => :mavericks) end - # Augment formula method :install to include a few more things. - def self.method_added method + # Augments formula method 'install' to include a few more things. + def self.method_added(method) # Check what is being added and patch (but only once). - return if method != :install || @tw_install_patched - @tw_install_patched = TRUE + return unless method == :install + return if @tw_install_patched + @tw_install_patched = true # Augment :install from formula with our extended version. alias_method :tw_install, :install
Improve code style of base class 'TwFormula'
diff --git a/cli_setup_client.rb b/cli_setup_client.rb index abc1234..def5678 100644 --- a/cli_setup_client.rb +++ b/cli_setup_client.rb @@ -3,5 +3,5 @@ # files that may be on the system current_dir = File.absolute_path(File.dirname(__FILE__)) chef_repo_path current_dir -cookbook_path ["#{current_dir}/vendor/cookbooks", "#{current_dir}/cookbooks"] +cookbook_path ["#{current_dir}/vendor/cookbooks"] file_cache_path File.join(current_dir, 'local-mode-cache', 'cache')
Fix warning for duplicate cookbook in setup Vendoring includes the cookbook itself in the vendor directory, so we don't need both. This quiets a warning about multiple instances of delivery_rust.
diff --git a/libPusher.podspec b/libPusher.podspec index abc1234..def5678 100644 --- a/libPusher.podspec +++ b/libPusher.podspec @@ -10,4 +10,5 @@ s.requires_arc = true s.dependency 'SocketRocket', "0.2" s.compiler_flags = '-Wno-arc-performSelector-leaks', '-Wno-format' + s.xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => 'kPTPusherClientLibraryVersion=@\"1.5\"' } end
Bugfix: Add preprocessor definition to podspec Otherwise the library version constant is missing when including libPusher via a Podfile
diff --git a/mince_model.gemspec b/mince_model.gemspec index abc1234..def5678 100644 --- a/mince_model.gemspec +++ b/mince_model.gemspec @@ -10,8 +10,8 @@ gem.summary = %q{Common model behavior for objects backed by Mince} gem.homepage = "http://github.com/ionicmobile/mince_model" - gem.files = %w(lib/mince_model lib/mince_model/version) - gem.test_files = %w(spec/lib/mince_model) + gem.files = %w(lib/mince_model.rb lib/mince_model/version.rb) + gem.test_files = %w(spec/lib/mince_model_spec.rb) gem.require_paths = ["lib"] gem.add_dependency 'activesupport', '~> 3.2'
Fix list of files in gemspec.
diff --git a/modules/ruby/spec/classes/ruby_spec.rb b/modules/ruby/spec/classes/ruby_spec.rb index abc1234..def5678 100644 --- a/modules/ruby/spec/classes/ruby_spec.rb +++ b/modules/ruby/spec/classes/ruby_spec.rb @@ -5,6 +5,5 @@ it do should contain_package('ruby1.9.1').with({'ensure' => '1.2.3.4.5.6'}) should contain_package('ruby1.9.1-dev').with({'ensure' => '1.2.3.4.5.6'}) - should contain_apt__repository('brightbox-ruby-ng') end end
Remove redundant test for brightbox repo
diff --git a/db/migrate/20161028102730_remove_url_from_containers.rb b/db/migrate/20161028102730_remove_url_from_containers.rb index abc1234..def5678 100644 --- a/db/migrate/20161028102730_remove_url_from_containers.rb +++ b/db/migrate/20161028102730_remove_url_from_containers.rb @@ -1,5 +1,15 @@ class RemoveUrlFromContainers < ActiveRecord::Migration[5.0] - def change - remove_column :ninetails_containers, :url, :string + def up + Ninetails::Page.with_deleted.all.each do |page| + page.revisions.each do |revision| + revision.update_attributes url: page.url unless revision.url.present? + end + end + + remove_column :ninetails_containers, :url + end + + def down + add_column :ninetails_containers, :url, :string end end
Update revisions before dropping urls from containers
diff --git a/models/character.rb b/models/character.rb index abc1234..def5678 100644 --- a/models/character.rb +++ b/models/character.rb @@ -27,6 +27,6 @@ field :ve, as: :version, type: Integer - field :tc as: :current_title, type: Integer - field :ti as: :titles, type: Array + field :tc, as: :current_title, type: Integer + field :ti, as: :titles, type: Array end
Fix typo in char model
diff --git a/lib/clockwork.rb b/lib/clockwork.rb index abc1234..def5678 100644 --- a/lib/clockwork.rb +++ b/lib/clockwork.rb @@ -1,5 +1,5 @@ require 'logger' -require 'active_support/time' +require 'active_support/core_ext/time' require 'clockwork/at' require 'clockwork/event'
Make compatible with active support 2.x
diff --git a/postpwn.gemspec b/postpwn.gemspec index abc1234..def5678 100644 --- a/postpwn.gemspec +++ b/postpwn.gemspec @@ -8,8 +8,8 @@ spec.version = Postpwn::VERSION spec.authors = ["TJ Stankus"] spec.email = ["tjstankus@gmail.com"] - spec.summary = %q{TODO: Write a short summary. Required.} - spec.description = %q{TODO: Write a longer description. Optional.} + spec.summary = %q{A writing tool.} + spec.description = %q{A writing and blogging tool.} spec.homepage = "" spec.license = "MIT"
Add summary and description to gemspec
diff --git a/recipes/rmagick.rb b/recipes/rmagick.rb index abc1234..def5678 100644 --- a/recipes/rmagick.rb +++ b/recipes/rmagick.rb @@ -22,7 +22,13 @@ when "redhat", "centos", "fedora" package "ImageMagick-devel" when "debian", "ubuntu" - package "libmagickwand-dev" + package value_for_platform( + "ubuntu" => { + "8.04" => "libmagick9-dev", + "8.10" => "libmagick9-dev", + }, + "default" => { "default" => "libmagickwand-dev" } + ) end gem_package "rmagick"
Use libmagick9-dev for the dev libraries on Ubuntu 8.04 and 8.10 The package changed to libmagickwand-dev after 8.10.
diff --git a/lib/lookout/rack/utils/subroute.rb b/lib/lookout/rack/utils/subroute.rb index abc1234..def5678 100644 --- a/lib/lookout/rack/utils/subroute.rb +++ b/lib/lookout/rack/utils/subroute.rb @@ -1,7 +1,10 @@ module Lookout::Rack::Utils module Subroute def subroute!(relative_path, options={}) - options.each { |k,v| request.send(request.request_method)[k] = v } + http_verb = request.request_method + # modify rack environment using Rack::Request- store passed in key/value + # pairs into hash associated with the parameters of the current http verb + options.each { |k,v| request.send(http_verb)[k] = v } subcode, subheaders, body = call(env.merge('PATH_INFO' => relative_path)) return [subcode, body.first] end
Add comment explaining modification of rack env
diff --git a/spec/integration/part/decorated_attributes_spec.rb b/spec/integration/part/decorated_attributes_spec.rb index abc1234..def5678 100644 --- a/spec/integration/part/decorated_attributes_spec.rb +++ b/spec/integration/part/decorated_attributes_spec.rb @@ -58,9 +58,8 @@ } it 'decorates exposures with the standard Dry::View::Part class' do - # byebug expect(article_part.author).to be_a Dry::View::Part - # expect(article_part.comments[0]).to be_a Dry::View::Part + expect(article_part.comments[0]).to be_a Dry::View::Part end end end
Check array elements are decorated
diff --git a/prowler.gemspec b/prowler.gemspec index abc1234..def5678 100644 --- a/prowler.gemspec +++ b/prowler.gemspec @@ -26,5 +26,5 @@ 'test/prowler_test.rb', ] - s.test_file = 'test/prowl_test.rb' + s.test_file = 'test/prowler_test.rb' end
Fix error in gem specification
diff --git a/Casks/vlc.rb b/Casks/vlc.rb index abc1234..def5678 100644 --- a/Casks/vlc.rb +++ b/Casks/vlc.rb @@ -9,7 +9,7 @@ :sha256 => '358ea9032ef0df1658c062bfb11ca4336ebf662b64bffec8e059b1e2faa4f788' name 'VLC' name 'VLC media player' - homepage 'http://www.videolan.org/vlc/' + homepage 'https://www.videolan.org/vlc/' license :oss app 'VLC.app'
Fix VLC homepage to use SSL The VLC homepage has SSL which should be the preferred default.
diff --git a/spec/config/series_checker_spec.rb b/spec/config/series_checker_spec.rb index abc1234..def5678 100644 --- a/spec/config/series_checker_spec.rb +++ b/spec/config/series_checker_spec.rb @@ -0,0 +1,19 @@+describe "config/series.yml" do # rubocop:disable RSpec/DescribeClass + series = YAML.load_file("#{spec_dir}/../config/series.yml") + + series.values.uniq {|attributes| attributes["series_name"] }.each do |attributes| + context attributes["title"] do + describe "started_date" do + subject { attributes["started_date"] } + + it { should be_sunday } + end + + describe "ended_date", if: attributes["ended_date"] do + subject { attributes["ended_date"] } + + it { should be_sunday } + end + end + end +end
Add test for started_date and ended_date
diff --git a/spec/configuration_manager_spec.rb b/spec/configuration_manager_spec.rb index abc1234..def5678 100644 --- a/spec/configuration_manager_spec.rb +++ b/spec/configuration_manager_spec.rb @@ -9,14 +9,14 @@ it 'parses options' do allow(config_manager).to receive(:parse_options_from_argv!) { { - :config => "/Users/jlynch/pg/nerve/spec/../example/nerve.conf.json", + :config => nerve_config, :instance_id => "testid", :check_config => false } } expect{config_manager.reload!}.to raise_error(RuntimeError) expect(config_manager.parse_options!).to eql({ - :config => "/Users/jlynch/pg/nerve/spec/../example/nerve.conf.json", + :config => nerve_config, :instance_id => "testid", :check_config => false })
Fix new spec that had a hard coded path
diff --git a/spec/features/admin/orders_spec.rb b/spec/features/admin/orders_spec.rb index abc1234..def5678 100644 --- a/spec/features/admin/orders_spec.rb +++ b/spec/features/admin/orders_spec.rb @@ -1,6 +1,7 @@ RSpec.feature 'Admin orders', type: :feature do background do + create(:store) sign_in_as! create(:admin_user) end
Fix specs now that order's store is required
diff --git a/spec/lib/extensions/ar_dba_spec.rb b/spec/lib/extensions/ar_dba_spec.rb index abc1234..def5678 100644 --- a/spec/lib/extensions/ar_dba_spec.rb +++ b/spec/lib/extensions/ar_dba_spec.rb @@ -23,9 +23,5 @@ it "returns true for a table with a primary key" do expect(connection.primary_key?("miq_databases")).to be true end - - it "returns true for composite primary keys" do - expect(connection.primary_key?("storages_vms_and_templates")).to be true - end end end
Remove spec with false premise We don't use composite primary keys any more. So although this spec passes it doesn't really indicate anything of value
diff --git a/spec/requests/events_pages_spec.rb b/spec/requests/events_pages_spec.rb index abc1234..def5678 100644 --- a/spec/requests/events_pages_spec.rb +++ b/spec/requests/events_pages_spec.rb @@ -0,0 +1,21 @@+require 'spec_helper' + +describe 'Events pages' do + + subject { page } + + describe 'for anonymous users' do + describe 'in the show page' do + + before do + @event = Fabricate(:event) + @event.save + visit event_path(@event) + end + + it { should have_page_title @event.name } + it { should_not have_link 'Edit' } + + end + end +end
Add simple spec for Events
diff --git a/spec/unit/mutant/isolation_spec.rb b/spec/unit/mutant/isolation_spec.rb index abc1234..def5678 100644 --- a/spec/unit/mutant/isolation_spec.rb +++ b/spec/unit/mutant/isolation_spec.rb @@ -15,6 +15,10 @@ it 'return block value' do expect(object.call { :foo }).to be(:foo) + end + + it 'wraps *all* exceptions' do + expect { object.call { fail } }.to raise_error(Mutant::Isolation::Error) end end @@ -37,5 +41,9 @@ expect(object.call { :foo }).to be(:foo) end + it 'wraps Parallel::DeadWorker exceptions' do + expect { object.call { fail Parallel::DeadWorker } }.to raise_error(Mutant::Isolation::Error) + end + end end
Add specification for isolation exception wrapping
diff --git a/NORMarkdownParser.podspec b/NORMarkdownParser.podspec index abc1234..def5678 100644 --- a/NORMarkdownParser.podspec +++ b/NORMarkdownParser.podspec @@ -18,6 +18,5 @@ s.frameworks = 'Foundation' s.requires_arc = true - s.header_dir = '' s.source_files = 'hoedown/**/*.{h,c}', 'NORMarkdownParser/*.{h,m}' end
[Podspec] Remove wrong header dir specification This is not needed and won't work anymore with the next release.
diff --git a/tchart.gemspec b/tchart.gemspec index abc1234..def5678 100644 --- a/tchart.gemspec +++ b/tchart.gemspec @@ -11,10 +11,10 @@ s.email = "milewgit@gmail.com" s.homepage = "https://github.com/milewgit/tchart" s.platform = Gem::Platform::RUBY - s.required_ruby_version = ">=2.0" + s.required_ruby_version = "~> 2.0" s.files = Dir[ "lib/**/**", "LICENSE.txt", "README.md" ] s.executables = [ "tchart" ] s.test_files = Dir[ "test/*_test.rb" ] s.has_rdoc = false - s.add_development_dependency "mocha", [ ">= 0.14.0" ] + s.add_development_dependency "mocha", [ "~> 0.14.0" ] end
Switch to ~> in gemspec.
diff --git a/oc-chef-pedant/spec/running_configs/ctl_command_spec.rb b/oc-chef-pedant/spec/running_configs/ctl_command_spec.rb index abc1234..def5678 100644 --- a/oc-chef-pedant/spec/running_configs/ctl_command_spec.rb +++ b/oc-chef-pedant/spec/running_configs/ctl_command_spec.rb @@ -0,0 +1,55 @@+require 'json' +require 'pedant/rspec/common' + +describe "running configs required by chef-server-ctl", :config do + let (:complete_config) { JSON.parse(IO.read("/etc/opscode/chef-server-running.json")) } + let (:config) { complete_config['private_chef'] } + + it "fips_enabled" do + expect(config['fips_enabled']).to be(true).or be(false) + end + + it "opscode-erchef/search_queue_mode" do + expect(config["opscode-erchef"]["search_queue_mode"]).to eq("rabbitmq") + .or eq("batch") + .or eq("inline") + end + + it "ldap/enabled" do + expect(config["ldap"]["enabled"]).to be(true).or be(false).or be(nil) + end + + it "runit/sv_dir" do + expect(complete_config["runit"]["sv_dir"].to_s).to_not eq("") + expect(File.exist?(complete_config["runit"]["sv_dir"])).to be(true) + end + + context "redis_lb" do + it "vip" do + expect(config["redis_lb"]["vip"].to_s).to_not eq("") + end + + it "port" do + expect(config["redis_lb"]["vip"].to_i).to_not eq(0) + end + end + + context "keepalived" do + it "enable" do + expect(config['keepalived']['enable']).to be(true).or be(false) + end + + it "vrrp_instance_ipaddress" do + expect(config['keepalived']['vrrp_instance_ipaddress']) + end + + it "vrrp_instance_ipaddress_dev" do + expect(config['keepalived']['vrrp_instance_ipaddress_dev']) + end + + it "vrrp_instance_interface" do + expect(config['keepalived']['vrrp_instance_interface']) + end + end + +end
[pedant] Add tests for configs used by chef-server-ctl Signed-off-by: Steven Danna <9ce5770b3bb4b2a1d59be2d97e34379cd192299f@chef.io>
diff --git a/spec/controllers/settings/mutes_controller_spec.rb b/spec/controllers/settings/mutes_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/settings/mutes_controller_spec.rb +++ b/spec/controllers/settings/mutes_controller_spec.rb @@ -17,4 +17,36 @@ end end end + + describe "#create" do + subject { post :create, params: { muted_phrase: "foo" } } + + context "user signed in" do + let(:user) { FactoryBot.create(:user) } + + before { sign_in user } + + it "creates a mute rule" do + expect { subject }.to(change { MuteRule.count }.by(1)) + end + end + end + + describe "#destroy" do + subject { delete :destroy, params: } + + context "user signed in" do + let(:user) { FactoryBot.create(:user) } + let(:rule) { MuteRule.create(user:, muted_phrase: "foo") } + let(:params) { { id: rule.id } } + + before { sign_in user } + + it "destroys a mute rule" do + subject + + expect(MuteRule.exists?(rule.id)).to eq(false) + end + end + end end
Add tests for mute rules
diff --git a/rspec-exercise/calculator_spec.rb b/rspec-exercise/calculator_spec.rb index abc1234..def5678 100644 --- a/rspec-exercise/calculator_spec.rb +++ b/rspec-exercise/calculator_spec.rb @@ -15,7 +15,7 @@ end # IF YOU'RE BORED... - describe "parsing for fun and profit" do + describe "parsing for fun and profit", pending: true do it "does simple addition" do expect( calculator.evaluate("2+2") ).to eq(4) end
Mark "bored" specs as pending for now
diff --git a/app/controllers/doctor_rails/checks_controller.rb b/app/controllers/doctor_rails/checks_controller.rb index abc1234..def5678 100644 --- a/app/controllers/doctor_rails/checks_controller.rb +++ b/app/controllers/doctor_rails/checks_controller.rb @@ -53,22 +53,5 @@ def get_checks methods.select{|n| n.to_s.match('check_') && !n.to_s.match('_description')} end - - def check_migrations - !(ActiveRecord::Migrator.current_version != get_latest_migration) - end - - def check_migrations_description - "Check if migrations are up to date." - end - - def get_latest_migration(dir = File.join(Rails.root, 'db', 'migrate')) - latest_migration = 0 - Dir[File.join(dir, "[0-9]*_*.rb")].each do |f| - l = f.scan(/0*([0-9]+)_[_a-zA-Z0-9]*.rb/).first.first - latest_migration = l if !latest_migration || l.to_i > latest_migration.to_i - end - latest_migration - end end end
Remove check for migrations from main controller. Standard checks should be defined somewhere else.
diff --git a/app/controllers/extranet/case_files_controller.rb b/app/controllers/extranet/case_files_controller.rb index abc1234..def5678 100644 --- a/app/controllers/extranet/case_files_controller.rb +++ b/app/controllers/extranet/case_files_controller.rb @@ -22,7 +22,7 @@ remain_files = @case.files #raise remain_files.inspect delete_file = remain_files.delete_at(index) - raise remain_files.inspect + #raise remain_files.inspect delete_file.try(:remove!) @case.files = remain_files; end
Remove inspector on case file controller (with Anna) Remove inspector on case file controller (with Anna)
diff --git a/test/features/support/pages/koha/item_types.rb b/test/features/support/pages/koha/item_types.rb index abc1234..def5678 100644 --- a/test/features/support/pages/koha/item_types.rb +++ b/test/features/support/pages/koha/item_types.rb @@ -16,7 +16,7 @@ def create(code, desc) @browser.execute_script("document.getElementById('newitemtype').click()") Watir::Wait.until { - @browser.form(:id => "itemtypeentry").text_field(:id => "itemtype").present? + @browser.text_field(:id => "itemtype").present? } form = @browser.form(:id => "itemtypeentry")
Add a new attempt at selecting only what we want directly
diff --git a/app/controllers/admin/admin_controller.rb b/app/controllers/admin/admin_controller.rb index abc1234..def5678 100644 --- a/app/controllers/admin/admin_controller.rb +++ b/app/controllers/admin/admin_controller.rb @@ -1,5 +1,6 @@ class Admin::AdminController < Admin::Controller before_action :load_settings, only: [:components, :update_components] + add_breadcrumb :components, :admin_components_path, if: :is_components_page? def index end @@ -23,4 +24,9 @@ def load_settings @settings = Instance::Settings.new(current_tenant) end + + # Checks if the current request is the components page. + def is_components_page? + Set['components', 'update_components'].freeze.include?(params[:action]) + end end
Add breadcrumbs for the components page.
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -2,4 +2,14 @@ # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception + before_filter :vary_by_accept + + private + + # This adds a Vary for responses. This is useful when returning a URL that + # has multiple representations depending on the Accepts header sent by the + # client. + def vary_by_accept + response.headers['Vary'] = 'Accept' + end end
Add Vary header for multiple representations
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -3,5 +3,17 @@ # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception - + private + + def current_user + User.find_by_id(session[:user_id]) if session[:user_id] + end + + def logged_in? + current_user != nil + end + + def authorized(creator_id) + current_user && current_user.id == creator_id + end end
Add current_user helper methods to application controller
diff --git a/app/views/compositions/show.json.jbuilder b/app/views/compositions/show.json.jbuilder index abc1234..def5678 100644 --- a/app/views/compositions/show.json.jbuilder +++ b/app/views/compositions/show.json.jbuilder @@ -1,6 +1,9 @@ json.composition do if @composition.persisted? json.id @composition.id + end + json.user do + json.battletag @composition.user.try(:battletag) end json.slug @composition.slug json.name @composition.name
Include creator info in composition JSON
diff --git a/lib/active_admin/reorderable/table_methods.rb b/lib/active_admin/reorderable/table_methods.rb index abc1234..def5678 100644 --- a/lib/active_admin/reorderable/table_methods.rb +++ b/lib/active_admin/reorderable/table_methods.rb @@ -11,7 +11,11 @@ private def reorder_handle_for(resource) - url = [active_admin_config.route_instance_path(resource), :reorder].join('/') + url = [ + active_admin_namespace.resource_for(resource.class).route_instance_path(resource), + :reorder + ].join('/') + span(reorder_handle_content, :class => 'reorder-handle', 'data-reorder-url' => url) end
Fix URL building for nested resources `active_admin_config` only works for the current resource being viewed and won't work for associated resources. This commit fixes that to use the active_admin_namespace to look up the resource definition for the given resource.
diff --git a/lib/asciidoctor-diagram/util/cli_generator.rb b/lib/asciidoctor-diagram/util/cli_generator.rb index abc1234..def5678 100644 --- a/lib/asciidoctor-diagram/util/cli_generator.rb +++ b/lib/asciidoctor-diagram/util/cli_generator.rb @@ -13,7 +13,7 @@ unless tool_path tool_path = parent.document.attributes[tool] tool_path = ::Asciidoctor::Diagram.which(tool) unless tool_path && File.executable?(tool_path) - raise "Could not find the '#{tool}' executable in PATH; add it to the PATH or specify its location using the 'shaape' document attribute" unless tool_path + raise "Could not find the '#{tool}' executable in PATH; add it to the PATH or specify its location using the '#{tool}' document attribute" unless tool_path instance_variable_set(tool_var, tool_path) end
Correct error message when diagram generating tool could not be found
diff --git a/lib/cognizant/process/conditions/cpu_usage.rb b/lib/cognizant/process/conditions/cpu_usage.rb index abc1234..def5678 100644 --- a/lib/cognizant/process/conditions/cpu_usage.rb +++ b/lib/cognizant/process/conditions/cpu_usage.rb @@ -0,0 +1,21 @@+require "cognizant/system" + +module Cognizant + class Process + module Conditions + class CpuUsage < Condition + def initialize(options = {}) + @above = options[:above] + end + + def run(pid) + System.cpu_usage(pid).to_f + end + + def check(value) + value > @above + end + end + end + end +end
Add a cpu usage condition.
diff --git a/0_code_wars/8_disemvowel.rb b/0_code_wars/8_disemvowel.rb index abc1234..def5678 100644 --- a/0_code_wars/8_disemvowel.rb +++ b/0_code_wars/8_disemvowel.rb @@ -0,0 +1,5 @@+# http://www.codewars.com/kata/52fba66badcd10859f00097e/ +# --- iterations --- +def disemvowel(str) + str.delete("aeiouAEIOU") +end
Add code wars (8) disemvowel
diff --git a/deployment/lib/server.rb b/deployment/lib/server.rb index abc1234..def5678 100644 --- a/deployment/lib/server.rb +++ b/deployment/lib/server.rb @@ -4,18 +4,21 @@ task :restart, :roles => :web do pretty_print "Gracefully restarting Apache" invoke_command "sudo /etc/init.d/apache2 graceful" + invoke_command "sudo /etc/init.d/varnish restart" puts_ok end task :start, :roles => :web do pretty_print "Starting Apache" invoke_command "sudo /etc/init.d/apache2 start" + invoke_command "sudo /etc/init.d/varnish start" puts_ok end task :stop, :roles => :web do pretty_print "Stopping Apache" invoke_command "sudo /etc/init.d/apache2 stop" + invoke_command "sudo /etc/init.d/varnish stop" puts_ok end
Add Varnish to restart/start/stop tasks
diff --git a/sorting.rb b/sorting.rb index abc1234..def5678 100644 --- a/sorting.rb +++ b/sorting.rb @@ -12,11 +12,11 @@ end def insertion_sort - self.dup.insertion_sort! + dup.insertion_sort! end def insertion_sort! - self.each_index do |i| + each_index do |i| j = i while j > 0 && self[j - 1] > self[j] self[j - 1], self[j] = self[j], self[j - 1] @@ -26,13 +26,13 @@ end def merge_sort - return self if self.size <= 1 - m = self.size / 2 + return self if size <= 1 + m = size / 2 merge(self[0...m].merge_sort, self[m..-1].merge_sort) end def merge_sort! - self.replace(self.merge_sort) + replace(merge_sort) end def merge(left, right) @@ -50,11 +50,11 @@ private :merge def bogosort - self.dup.bogosort! + dup.bogosort! end def bogosort! - self.shuffle! until each_cons(2).all? { |a, b| a <= b } + shuffle! until each_cons(2).all? { |a, b| a <= b } self end end
Remove reference to self where redundant
diff --git a/providers/domain.rb b/providers/domain.rb index abc1234..def5678 100644 --- a/providers/domain.rb +++ b/providers/domain.rb @@ -20,16 +20,25 @@ sub_resource.run_action(:create) end - template ::File.join(node['ulimit']['security_limits_directory'], new_resource.filename) do + utemplate = template ::File.join(node['ulimit']['security_limits_directory'], new_resource.filename) do source 'domain.erb' cookbook 'ulimit' variables :domain => new_resource.domain_name end + + unless(self.respond_to?(:use_inline_resources)) + new_resource.updated_by_last_action(ufile.updated_by_last_action?) + end + end action :delete do use_inline_resources if self.respond_to?(:use_inline_resources) - file ::File.join(node['ulimit']['security_limits_directory'], new_resource.filename) do + ufile = file ::File.join(node['ulimit']['security_limits_directory'], new_resource.filename) do action :delete end + + unless(self.respond_to?(:use_inline_resources)) + new_resource.updated_by_last_action(ufile.updated_by_last_action?) + end end
Update resource status by hand if required
diff --git a/setup/dusty.rb b/setup/dusty.rb index abc1234..def5678 100644 --- a/setup/dusty.rb +++ b/setup/dusty.rb @@ -4,7 +4,7 @@ url "https://github.com/gamechanger/dusty/releases/download/#{version}/dusty.tar.gz" appcast 'https://github.com/gamechanger/dusty/releases.atom', - :sha256 => '14dd655e5ed3a55495436c0fc9fb426bedb461a600083d10f72f330c66181d7a' + :checkpoint => '14dd655e5ed3a55495436c0fc9fb426bedb461a600083d10f72f330c66181d7a' name 'Dusty' homepage 'https://github.com/gamechanger/dusty' license :mit
Change to new Cask format
diff --git a/Casks/google-chrome-beta.rb b/Casks/google-chrome-beta.rb index abc1234..def5678 100644 --- a/Casks/google-chrome-beta.rb +++ b/Casks/google-chrome-beta.rb @@ -3,6 +3,7 @@ sha256 :no_check url 'https://dl.google.com/chrome/mac/beta/googlechrome.dmg' + name 'Google Chrome' homepage 'https://www.google.com/chrome/browser/beta.html?platform=mac&extra=betachannel' license :gratis tags :vendor => 'Google'
Add name stanza to Google Chrome Beta
diff --git a/diff_match_patch.gemspec b/diff_match_patch.gemspec index abc1234..def5678 100644 --- a/diff_match_patch.gemspec +++ b/diff_match_patch.gemspec @@ -1,12 +1,12 @@ Gem::Specification.new do |s| - s.name = "diff_match_patch" - s.version = "0.0.1" - s.date = Time.now.utc.strftime("%Y-%m-%d") - s.homepage = "https://github.com/nono/diff_match_patch-ruby" - s.authors = "Matthias Reitinger" - s.email = "reitinge@in.tum.de" - s.description = "Port of google-diff-match-patch to Ruby 1.9 " - s.summary = "Port of google-diff-match-patch to Ruby 1.9 " - s.files = Dir["LICENSE.txt", "diff_match_patch.rb"] - s.rubygems_version = %q{1.3.7} + s.name = "diff_match_patch" + s.version = "0.0.1" + s.date = Time.now.utc.strftime("%Y-%m-%d") + s.homepage = "https://github.com/nono/diff_match_patch-ruby" + s.authors = "Matthias Reitinger" + s.email = "reitinge@in.tum.de" + s.description = "Port of google-diff-match-patch to Ruby 1.9 " + s.summary = "Port of google-diff-match-patch to Ruby 1.9 " + s.files = Dir["LICENSE.txt", "diff_match_patch.rb"] + s.require_path = '.' end
Add a gemspec file, to use this lib with bundler
diff --git a/telegram_bot.gemspec b/telegram_bot.gemspec index abc1234..def5678 100644 --- a/telegram_bot.gemspec +++ b/telegram_bot.gemspec @@ -21,7 +21,7 @@ s.add_dependency 'virtus' - s.add_development_dependency "bundler", "~> 1.11" + s.add_development_dependency "bundler", "~> 1.7" s.add_development_dependency "rake", "~> 10.0" s.add_development_dependency "rspec", "~> 3.0" end
Update dependencies for older versions of ruby.
diff --git a/0_code_wars/string_of_first_n_chars.rb b/0_code_wars/string_of_first_n_chars.rb index abc1234..def5678 100644 --- a/0_code_wars/string_of_first_n_chars.rb +++ b/0_code_wars/string_of_first_n_chars.rb @@ -0,0 +1,10 @@+# http://www.codewars.com/kata/5639bdcef2f9b06ce800005b/ +# --- iteration 2 --- +def make_string(s) + s.split.reduce(""){ |acc, el| acc << el[0] } +end + +# --- iteration 2 --- +def make_string(s) + s.split.map(&:chr).join +end
Add code wars (7) string of first n chars
diff --git a/spec/models/spree/bp_order_row_spec.rb b/spec/models/spree/bp_order_row_spec.rb index abc1234..def5678 100644 --- a/spec/models/spree/bp_order_row_spec.rb +++ b/spec/models/spree/bp_order_row_spec.rb @@ -20,7 +20,7 @@ bp_order_row.save end end - + def match_fields(line_item) { productId: line_item.variant.brightpearl_id, @@ -28,7 +28,7 @@ magnitude: line_item.quantity }, rowValue: { - taxCode: 'T', + taxCode: 'T4', rowNet: { currencyCode: Spree::Config[:currency], value: line_item.price.to_f
Fix spec for last commit
diff --git a/spec/support/pageflow/rails_version.rb b/spec/support/pageflow/rails_version.rb index abc1234..def5678 100644 --- a/spec/support/pageflow/rails_version.rb +++ b/spec/support/pageflow/rails_version.rb @@ -5,7 +5,7 @@ RAILS_VERSION_FILE = File.expand_path('../../../../.rails_version') def detect - from_env || from_file || '4.2.6' + from_env || from_file || '4.2.9' end private
Update rails gem to 4.2.9
diff --git a/spec/support/plain_old_ruby_objects.rb b/spec/support/plain_old_ruby_objects.rb index abc1234..def5678 100644 --- a/spec/support/plain_old_ruby_objects.rb +++ b/spec/support/plain_old_ruby_objects.rb @@ -42,9 +42,11 @@ class ChildRubyObject < Persistable attr_accessor \ - :parent_ruby_object, :parent_ruby_object_id, :number_field + + attr_reader \ + :parent_ruby_object def parent_ruby_object=(parent_ruby_object) @parent_ruby_object = parent_ruby_object
Define only the reader because the writer is defined below
diff --git a/0_code_wars/did_she_say_hallo.rb b/0_code_wars/did_she_say_hallo.rb index abc1234..def5678 100644 --- a/0_code_wars/did_she_say_hallo.rb +++ b/0_code_wars/did_she_say_hallo.rb @@ -0,0 +1,15 @@+# http://www.codewars.com/kata/56a4addbfd4a55694100001f/ +# --- iteration 1 --- +@hallos = %w(hello ciao salut hallo hola ahoj czesc) + +def validate_hello(greetings) + @hallos.each do |hallo| + return true if /#{hallo}/ === greetings.downcase + end + false +end + +# --- iteration 2 --- +def validate_hello(greetings) + /hello|ciao|salut|hallo|hola|ahoj|czesc/i === greetings +end
Add code wars (7) did she say hallo
diff --git a/spec/guard/commands/scope_spec.rb b/spec/guard/commands/scope_spec.rb index abc1234..def5678 100644 --- a/spec/guard/commands/scope_spec.rb +++ b/spec/guard/commands/scope_spec.rb @@ -5,7 +5,7 @@ before do Guard.stub(:scope=) Guard.stub(:setup_interactor) - Pry.output.stub(puts: true) + Pry.output.stub(:puts => true) stub_const 'Guard::Bar', Class.new(Guard::Guard) end
Use Ruby 1.8 Hash style
diff --git a/spec/i18n_locale_switcher_spec.rb b/spec/i18n_locale_switcher_spec.rb index abc1234..def5678 100644 --- a/spec/i18n_locale_switcher_spec.rb +++ b/spec/i18n_locale_switcher_spec.rb @@ -1,6 +1,11 @@ require "spec_helper" describe "Rack::I18nLocaleSwitcher" do + + before do + I18n.available_locales = [:en, :'en-US', :de, :'de-DE'] + I18n.default_locale = :en + end def app Rack::Builder.new { @@ -11,12 +16,80 @@ }.to_app end - - it "should detect locale from Accept-Language-Header" do - get '/', {'Accept-Language' => 'en-US, en'} - I18n.locale.should == :en + it "should set the locate to default locale" do + get '/' + I18n.locale.should eql(I18n.default_locale) end + context 'from request params' do + + it "should set the I18n locale" do + get '/', :locale => 'de' + last_request.url.should include('?locale=de') + I18n.locale.should eql(:de) + end + + it "should disallow other locales than the available locales" do + get '/', :locale => 'xx' + I18n.locale.should eql(I18n.default_locale) + end + + end + + context 'from path prefix ' do + it "should set the I18n locale" do + get '/de/' + I18n.locale.should eql(:de) + end + end + + context 'from subdomain' do + + before do + default_host = 'de.example.com' + end + + xit "should set the I18n locale" do + get '/' + I18n.locale.should eql(:de) + end + end + + context 'from top level domain' do + + before do + default_host = 'example.de' + + it "should set the I18n locale" do + get '/' + I18n.locale.should eql(:de) + end + end + end + + context 'from accept-language header' do + + it "should override the client requested locale" do + header "Accept-Language", "de, en" + get '/' + I18n.locale.should eql(:de) + end + + end + + context 'from session' do + xit "should override the users session locale" do + request.session['locale'] = :de + get '/', :locale => 'en' + I18n.locale.should eql(:en) + end + + + end + + context 'from default' do + end + end
Add more to ensure the switcher works with http header.
diff --git a/spec/middleware/angerfist_spec.rb b/spec/middleware/angerfist_spec.rb index abc1234..def5678 100644 --- a/spec/middleware/angerfist_spec.rb +++ b/spec/middleware/angerfist_spec.rb @@ -0,0 +1,28 @@+require 'spec_helper' +require 'rack' +require 'gabba' +require 'angerfist' + +describe AngerFist do + + it "tracks a page view for JSON" do + content_type = "application/json" + app = proc{[200,{"CONTENT-TYPE" => content_type},['Hello, world.']]} + middleware = AngerFist.new(app, "UA-xxxxxxx-x", "http://test.domain") + request = Rack::MockRequest.new(middleware) + + expect_any_instance_of(Gabba::Gabba).to receive(:page_view) + request.get('addresses/address.json', { "CONTENT-TYPE" => content_type }) + end + + it "doesn't track a page view for HTML" do + content_type = "text/html" + app = proc{[200,{"CONTENT-TYPE" => content_type},['Hello, world.']]} + middleware = AngerFist.new(app, "UA-xxxxxxx-x", "http://test.domain") + request = Rack::MockRequest.new(middleware) + + expect_any_instance_of(Gabba::Gabba).to_not receive(:page_view) + request.get('addresses/address.json', { "CONTENT-TYPE" => content_type }) + end + +end
Add tests for current AngerFist functionality
diff --git a/test/policies/owned_policy_test.rb b/test/policies/owned_policy_test.rb index abc1234..def5678 100644 --- a/test/policies/owned_policy_test.rb +++ b/test/policies/owned_policy_test.rb @@ -7,8 +7,8 @@ describe OwnedPolicy do let(:account) { create(:account) } let(:owned) { OwnedTestModel.new.tap { |o| o.owner = account } } - let(:token) { StubToken.new(account.id, ['member']) } - let(:bad_token) { StubToken.new(account.id + 1, ['member']) } + let(:token) { StubToken.new(account.id, ['account']) } + let(:bad_token) { StubToken.new(account.id + 1, ['account']) } describe '#update? or #create?' do it 'returns true if authorized on owning account' do
Update OwnedPolicy test to reflect that it is exercising AccountPolicy
diff --git a/app/models/import/central_heat_network_builder.rb b/app/models/import/central_heat_network_builder.rb index abc1234..def5678 100644 --- a/app/models/import/central_heat_network_builder.rb +++ b/app/models/import/central_heat_network_builder.rb @@ -1,13 +1,15 @@ class Import class CentralHeatNetworkBuilder - TECHNOLOGIES = %w(central_heat_network_dispatchable - central_heat_network_must_run) + TECHNOLOGIES = %w( + central_heat_network_dispatchable + central_heat_network_must_run + ).freeze ATTRIBUTES = Hash[ [ CentralHeatNetworkDispatchableCapacityAttribute, CentralHeatNetworkMustRunHeatProductionAttribute].map do |attr| - [attr.remote_name, attr] - end + [attr.remote_name, attr] + end ] def initialize(scenario_id) @@ -15,7 +17,7 @@ end def self.build(scenario_id) - self.new(scenario_id).build_technologies + new(scenario_id).build_technologies end def build_technologies
Adjust central heat builder per RuboCop
diff --git a/recipes/install1.rb b/recipes/install1.rb index abc1234..def5678 100644 --- a/recipes/install1.rb +++ b/recipes/install1.rb @@ -28,8 +28,4 @@ end - wlp do - server_name serverName - end - end
Remove the use of the wlp provider as its all in wlp_application now
diff --git a/app/services/service_sign_in_unpublish_service.rb b/app/services/service_sign_in_unpublish_service.rb index abc1234..def5678 100644 --- a/app/services/service_sign_in_unpublish_service.rb +++ b/app/services/service_sign_in_unpublish_service.rb @@ -2,10 +2,11 @@ class << self def call(content_id, locale, redirect_path: nil) @content_id = content_id + @locale = locale if redirect_path.present? - unpublish_redirect(locale, redirect_path) + unpublish_redirect(redirect_path) else - unpublish_gone(locale) + unpublish_gone end end @@ -16,22 +17,25 @@ end def content_item - @content_item ||= Services.publishing_api.get_content(@content_id) + @content_item ||= Services.publishing_api.get_content( + @content_id, + locale: @locale, + ) end - def unpublish_gone(locale) + def unpublish_gone Services.publishing_api.unpublish( @content_id, - locale: locale, + locale: @locale, type: "gone", discard_drafts: true, ) end - def unpublish_redirect(locale, redirect_path) + def unpublish_redirect(redirect_path) Services.publishing_api.unpublish( @content_id, - locale: locale, + locale: @locale, type: "redirect", discard_drafts: true, redirects: [
Use locale when fetching content items to unpublish
diff --git a/app/models/error_template.rb b/app/models/error_template.rb index abc1234..def5678 100644 --- a/app/models/error_template.rb +++ b/app/models/error_template.rb @@ -1,4 +1,8 @@ class ErrorTemplate < ActiveRecord::Base belongs_to :execution_environment has_and_belongs_to_many :error_template_attributes + + def to_s + "#{id} [#{name}]" + end end
Fix string in heading and breadcrumbs
diff --git a/LeetCode/remote/remove_duplicate_from_sorted_list.rb b/LeetCode/remote/remove_duplicate_from_sorted_list.rb index abc1234..def5678 100644 --- a/LeetCode/remote/remove_duplicate_from_sorted_list.rb +++ b/LeetCode/remote/remove_duplicate_from_sorted_list.rb @@ -0,0 +1,24 @@+# https://leetcode.com/problems/remove-duplicates-from-sorted-list/ +# Given a sorted linked list, delete all duplicates such that each element appear only once. +# https://leetcode.com/submissions/detail/55726906/ +# +# Submission Details +# 164 / 164 test cases passed. +# Status: Accepted +# Runtime: 88 ms +# +# Submitted: 0 minutes ago +# You are here! +# Your runtime beats 88.00% of rubysubmissions. +def delete_duplicates(head) + it = head + while it + if it.next && it.val == it.next.val + it.next = it.next.next + else + it = it.next + end + end + + head +end
Remove dupes from sorted list
diff --git a/rom-support.gemspec b/rom-support.gemspec index abc1234..def5678 100644 --- a/rom-support.gemspec +++ b/rom-support.gemspec @@ -3,7 +3,7 @@ require File.expand_path('../lib/rom/support/version', __FILE__) Gem::Specification.new do |gem| - gem.name = 'rom' + gem.name = 'rom-support' gem.summary = 'Ruby Object Mapper - Support libraries' gem.description = gem.summary gem.author = 'Piotr Solnica'
Fix gem name in the gemspec
diff --git a/app/controllers/api/v2/zone_topic_formulas_controller.rb b/app/controllers/api/v2/zone_topic_formulas_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/v2/zone_topic_formulas_controller.rb +++ b/app/controllers/api/v2/zone_topic_formulas_controller.rb @@ -7,7 +7,7 @@ package = current_project_anchor.project.packages.find(params[:set_id]) rule = package.zone_activity_rule if rule.nil? - rule = package.rules.create!(kind: :zone, name: package.name + " - zone activity") + rule = package.rules.create!(kind: :zone_activity, name: package.name + " - zone activity") end rule end
Fix zone topic formulas creation
diff --git a/app/controllers/neighborly/api/v1/sessions_controller.rb b/app/controllers/neighborly/api/v1/sessions_controller.rb index abc1234..def5678 100644 --- a/app/controllers/neighborly/api/v1/sessions_controller.rb +++ b/app/controllers/neighborly/api/v1/sessions_controller.rb @@ -11,10 +11,10 @@ user_id: user.id } else - head :unauthorized + render status: :unauthorized, json: { } end rescue KeyError - head :bad_request + render status: :bad_request, json: { } end def destroy
Add empty json response when requests are 401 and 400 on sessions endpoint This is necessary because some JS framework don't work well when the response is empty.