diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/lib/guidestar.rb b/lib/guidestar.rb index abc1234..def5678 100644 --- a/lib/guidestar.rb +++ b/lib/guidestar.rb @@ -23,6 +23,5 @@ end end - Faraday::Response.register_middleware :response, - :raise_guidestar_error => lambda { Faraday::Response::RaiseGuidestarError } + Faraday::Response.register_middleware :raise_guidestar_error => Faraday::Response::RaiseGuidestarError end
Use new syntax for registering middleware
diff --git a/lib/munge/extras/livereload/server.rb b/lib/munge/extras/livereload/server.rb index abc1234..def5678 100644 --- a/lib/munge/extras/livereload/server.rb +++ b/lib/munge/extras/livereload/server.rb @@ -16,6 +16,7 @@ socket << @messaging.reload(file) end rescue Reel::SocketError + print_error("error pushing livereload notification to browser") end end end @@ -43,6 +44,7 @@ end end rescue Reel::SocketError + print_error("error with livereload socket") end def handle_request(request) @@ -53,6 +55,10 @@ request.respond(:not_found, "not found") end end + + def print_error(message) + $stderr.puts(message) + end end end end
Handle Reel::SocketError instead of ignoring
diff --git a/lib/rubocop/rspec/config_formatter.rb b/lib/rubocop/rspec/config_formatter.rb index abc1234..def5678 100644 --- a/lib/rubocop/rspec/config_formatter.rb +++ b/lib/rubocop/rspec/config_formatter.rb @@ -15,7 +15,9 @@ end def dump - YAML.dump(unified_config).gsub(EXTENSION_ROOT_DEPARTMENT, "\n\\1") + YAML.dump(unified_config) + .gsub(EXTENSION_ROOT_DEPARTMENT, "\n\\1") + .gsub(/^(\s+)- /, '\1 - ') end private
Fix indentation in generated YAML
diff --git a/app/uploaders/francis_cms/author_avatar_uploader.rb b/app/uploaders/francis_cms/author_avatar_uploader.rb index abc1234..def5678 100644 --- a/app/uploaders/francis_cms/author_avatar_uploader.rb +++ b/app/uploaders/francis_cms/author_avatar_uploader.rb @@ -20,11 +20,14 @@ def manipulate_author_avatar(geometry) manipulate! do |img| - img.interlace('Plane') - img.quality(72) - img.resize(geometry) img.strip - img.unsharp(1) + + img.combine_options do |c| + c.interlace 'plane' + c.quality 72 + c.resize geometry + c.unsharp 1 + end img = yield(img) if block_given? img
Rework image manipulation so that JPGs are actually progressive.
diff --git a/lib/wicket-sdk/resource_collection.rb b/lib/wicket-sdk/resource_collection.rb index abc1234..def5678 100644 --- a/lib/wicket-sdk/resource_collection.rb +++ b/lib/wicket-sdk/resource_collection.rb @@ -8,7 +8,7 @@ ].freeze def initialize(data = []) - data = [data].compact! unless data.is_a?(Array) + data = [data].compact unless data.is_a?(Array) super(data) end @@ -22,7 +22,7 @@ type = type.to_s select do |res| - if res.is_a? Resource + if res.is_a? ResourceIdentifier res.type == type else res['type'] == type
Check for ResourceIdentifier + fix bug on initialize when not an array.
diff --git a/spec/models_spec.rb b/spec/models_spec.rb index abc1234..def5678 100644 --- a/spec/models_spec.rb +++ b/spec/models_spec.rb @@ -9,12 +9,12 @@ end end -Reso::DataDictionary.specification.resources.each do |resource| - RSpec.describe "#{resource} attributes" do - Reso::DataDictionary.specification.fields_for_class(resource).map{|f| f[:attribute_name]}.each do |attr| - it attr do - end - end - end -end +# Reso::DataDictionary.specification.resources.each do |resource| +# RSpec.describe "#{resource} attributes" do +# Reso::DataDictionary.specification.fields_for_class(resource).map{|f| f[:attribute_name]}.each do |attr| +# it attr do +# end +# end +# end +# end
Comment out field test specs for now
diff --git a/spec/runner_spec.rb b/spec/runner_spec.rb index abc1234..def5678 100644 --- a/spec/runner_spec.rb +++ b/spec/runner_spec.rb @@ -28,7 +28,7 @@ end it 'no documentation is nil' do - subject[0].no_documentation.should be_nil + subject[0].no_documentation.should be_false end it 'documented parameters' do
Update spec for no_documenation parameter Changed from defaulting to nil to defaulting to false
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -12,6 +12,7 @@ RSpec.configure do |config| config.around do |example| + next example.run unless example.metadata.fetch(:rollback, true) ActiveRecord::Base.transaction do begin example.run
Allow rollback to be skipped using RSpec metadata
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -22,4 +22,9 @@ def appboy_test_segment ::ENV.fetch('APPBOY_TEST_SEGMENT', 'fake-test-segment') end + + def appboy_schedule_id + @appboy_schedule_id ||= 'fake-schedule-id' + @appboy_schedule_id + end end
Add RSpec appboy_schedule_id global test method
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,5 +1,7 @@-require 'coveralls' -Coveralls.wear! +if ENV['CI'] + require 'coveralls' + Coveralls.wear! +end spec_path = File.dirname(__FILE__) $LOAD_PATH.unshift(spec_path)
Use coveralls only on CI
diff --git a/main.rb b/main.rb index abc1234..def5678 100644 --- a/main.rb +++ b/main.rb @@ -6,14 +6,26 @@ class Terminal def initialize(variable_terminals) - if rand > 0.5 + if is_variable? @terminal = variable_terminals.sample else @terminal = (10 * rand).round(1) - if rand > 0.5 + if make_number_negative? @terminal = -1 * @terminal end end + end + + def is_variable? + coin_toss_is_heads? + end + + def make_number_negative? + coin_toss_is_heads? + end + + def coin_toss_is_heads? + rand > 0.5 end def to_s @@ -42,9 +54,6 @@ return op end - def get_terminal(variable_terminals) - end - def to_s "( " + @operand_1.to_s + " " + @operator.to_s + " " + @operand_2.to_s + " )" end
Add predicates to Terminal class
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -7,11 +7,11 @@ require 'rspec' if defined? require_relative - require_relative 'support/localhost_server.rb' - require_relative 'support/server.rb' + require_relative 'support/localhost_server' + require_relative 'support/server' else - require 'support/localhost_server.rb' - require 'support/server.rb' + require 'support/localhost_server' + require 'support/server' end # Ethon.logger = Logger.new($stdout).tap do |log|
Remove unneeded .rb from some requires
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -2,10 +2,7 @@ require 'pathname' DIR = Pathname.new(__FILE__ + '../..').expand_path.dirname -LOAD_PATH = DIR.join('lib').to_s -$LOAD_PATH.unshift(LOAD_PATH) unless - $LOAD_PATH.include?(LOAD_PATH) || $LOAD_PATH.include?(File.expand_path(LOAD_PATH)) -require 'roxml' +require 'lib/roxml' if defined?(Spec) require File.join(File.dirname(__FILE__), 'shared_specs')
Remove more unnecessary LOAD_PATH fiddling
diff --git a/main.rb b/main.rb index abc1234..def5678 100644 --- a/main.rb +++ b/main.rb @@ -7,19 +7,31 @@ end def add_up(level) + @up_requests |= (1 << (level - 1)) if level > 0 # set corresponding bit starting from right most position + end + + def add_down(level) + @down_requests |= (1 << (level - 1)) if level > 0 # set corresponding bit starting from right most position + end + + def serve_up(level) + @up_requests &= ~(1 << (level - 1)) if level > 0 # unset corresponding bit starting from right most position + end + + def serve_down(level) + @down_requests &= ~(1 << (level - 1)) if level > 0 # unset corresponding bit starting from right most position + end + + def served_all? end - def add_down(level) + def requests_waiting?(current_level, direction) end - def serve_up(level) - - end - - def serve_down(level) - + def print_list + puts "up requests --> #{@up_requests.to_s(2)} :: down requests --> #{@down_requests.to_s(2)}" end end @@ -51,4 +63,18 @@ def flip_direction end -end+end + + +requests = RequestList.new +requests.add_up(2) +requests.add_up(4) +requests.add_down(1) +requests.add_down(2) +requests.print_list + +requests.serve_up(2) +requests.serve_up(4) +requests.serve_down(1) +requests.serve_down(2) +requests.print_list
Add methods to set and serve requests
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -8,5 +8,3 @@ config.version = '18.04' config.log_level = :fatal end - -at_exit { ChefSpec::Coverage.report! }
Drop obsolete ChefSpec coverage from unit tests No longer available; it causes an error in testing
diff --git a/lib/hotspots/repository/driver/git.rb b/lib/hotspots/repository/driver/git.rb index abc1234..def5678 100644 --- a/lib/hotspots/repository/driver/git.rb +++ b/lib/hotspots/repository/driver/git.rb @@ -19,8 +19,8 @@ def execute_with_log(command) command.run.tap do |output| - @log.message("[input] #{command}", :level => :info, :colour => :green) - @log.message("[output] #{output}", :level => :info, :colour => :red) + @log.message("[input]\n#{command}", :level => :info, :colour => :green) + @log.message("[output]\n#{output}", :level => :info, :colour => :red) end end end
Include new-line between message and actual input/output
diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/users_controller_spec.rb +++ b/spec/controllers/users_controller_spec.rb @@ -26,7 +26,7 @@ phone: '1234567890', image: 'http://media3.s-nbcnews.com/i/newscms/2015_37/764896/the-rock-saves-puppy-today-tease-1-150908_54fb4b0bfa08dee373c956cefb9b9c49.jpg') patch(:update, user: valid_user) - response.should render_template("show") + expect(response).to render_template("show") end end @@ -35,7 +35,7 @@ invalid_user = attributes_for(:user, phone: 'not a string of numbers') patch(:update, user: invalid_user) - response.should render_template("edit") + expect(response).to render_template("edit") end end end
Refactor User controller spec to use expect instead of should
diff --git a/lib/pg-quilter.rb b/lib/pg-quilter.rb index abc1234..def5678 100644 --- a/lib/pg-quilter.rb +++ b/lib/pg-quilter.rb @@ -12,3 +12,4 @@ require 'pg-quilter/build' require 'pg-quilter/build_runner' require 'pg-quilter/task_master' +require 'pg-quilter/worker'
Include worker; still required for specs
diff --git a/lib/randomtext.rb b/lib/randomtext.rb index abc1234..def5678 100644 --- a/lib/randomtext.rb +++ b/lib/randomtext.rb @@ -0,0 +1,9 @@+%w{randomtext/markov_chain randomtext/text_generator randomtext/weighted_directed_graph}.each do |file| + require File.expand_path file, File.dirname(__FILE__) +end + +module RandomText + + #this space intentionally left blank + +end
Add top level module that can be require'd. Probably should have let Bundler gem this up for me instead of fumbling my way through creating a gem from scratch, but I'll consider that a lesson learned.
diff --git a/lib/tasks/chat.rb b/lib/tasks/chat.rb index abc1234..def5678 100644 --- a/lib/tasks/chat.rb +++ b/lib/tasks/chat.rb @@ -0,0 +1,16 @@+# Due to a bug ChatChannelsUsers and ChatMessages without a channel_id were created. +# This tasks deletes them. +namespace :cg do + namespace :chat do + desc "Deletes ChatChannelsUsers and ChatMessages without a channel_id" + task(:clean_invalid => :environment) do + ChatChannelsUser.all(:conditions => "channel_id IS NULL").each do |c_user| + c_user.destroy + end + ChatMessage.all(:conditions => "channel_id IS NULL").each do |m| + m.destroy + end + end + end +end +
Add task to delete ChatChannelsUsers and ChatMessages without a channel_id.
diff --git a/ajax-nested-fields.gemspec b/ajax-nested-fields.gemspec index abc1234..def5678 100644 --- a/ajax-nested-fields.gemspec +++ b/ajax-nested-fields.gemspec @@ -21,5 +21,8 @@ s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } + + s.files.reject! {|fn| fn =~ /^example/} + s.require_paths = ["lib"] end
Remove example from build file
diff --git a/features/support/env.rb b/features/support/env.rb index abc1234..def5678 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -16,3 +16,10 @@ World(SinatraTestIntegration) World(SchemaHelpers) + +Around do |_, block| + delete_command = "curl -XDELETE 'http://localhost:9200/finder-api'" + system(delete_command) + block.call + system(delete_command) +end
Delete the finder-api index before & after cukes.
diff --git a/core/app/models/spree/unit_cancel.rb b/core/app/models/spree/unit_cancel.rb index abc1234..def5678 100644 --- a/core/app/models/spree/unit_cancel.rb +++ b/core/app/models/spree/unit_cancel.rb @@ -6,18 +6,18 @@ DEFAULT_REASON = 'Cancel' belongs_to :inventory_unit - has_one :adjustment, as: :source, dependent: :destroy + has_many :adjustments, as: :source, dependent: :destroy validates :inventory_unit, presence: true # Creates necessary cancel adjustments for the line item. def adjust! - raise "Adjustment is already created" if adjustment + raise "Adjustment is already created" if adjustments.exists? amount = compute_amount(inventory_unit.line_item) - create_adjustment!( - adjustable: inventory_unit.line_item, + inventory_unit.line_item.adjustments.create!( + source: self, amount: amount, order: inventory_unit.order, label: "#{Spree.t(:cancellation)} - #{reason}",
Change UnitCancel adjustments association to has_many This makes it the same as all the other `adjustments` relationships which makes the repair code in Adjustment simpler, and it makes it easier to query for duplicates. Also, use `line_item.adjustments.create` instead of `unit_cancel.adjustments.create`. The latter bypasses `line_item.adjustments` which makes them outdated for further use.
diff --git a/spec/ClassBrowser_spec.rb b/spec/ClassBrowser_spec.rb index abc1234..def5678 100644 --- a/spec/ClassBrowser_spec.rb +++ b/spec/ClassBrowser_spec.rb @@ -1,3 +1,6 @@+require "codeclimate-test-reporter" +CodeClimate::TestReporter.start + require_relative '../lib/ClassBrowser' describe "Test that the ObjectSpace hierarchy can be displayed" do
Add code climate to spec
diff --git a/spec/bsf/database_spec.rb b/spec/bsf/database_spec.rb index abc1234..def5678 100644 --- a/spec/bsf/database_spec.rb +++ b/spec/bsf/database_spec.rb @@ -9,8 +9,13 @@ describe '.initialize' do - it 'connects to the database' do + it 'connects to the database via socket' do described_class.new(options).instance_variable_get(:@connection).class. + should == Sequel::SQLite::Database + end + + it 'connects to the database via TCP/IP' do + described_class.new(options(true)).instance_variable_get(:@connection).class. should == Sequel::SQLite::Database end @@ -29,9 +34,11 @@ end - def options - { :database_name => 'test', :database_user => 'test', + def options(host = false) + hash = { :database_name => 'test', :database_user => 'test', :database_password => 'test' } + hash[:database_host] = '127.0.0.1' if host + hash end end
Add database TCP/IP connection test. Add a test to make sure that our Database class will connect via TCP/IP if the option is included in the hash. While in the background the database is still an in memory database that doesn't care about the hash passed to it we should still test to see that the line adding that hash key is executed
diff --git a/spec/send_message_spec.rb b/spec/send_message_spec.rb index abc1234..def5678 100644 --- a/spec/send_message_spec.rb +++ b/spec/send_message_spec.rb @@ -13,4 +13,18 @@ KannelRails.send_message("09101111111", "Hello World!") end + context "with extra params" do + it "should pass params to kannel" do + stub_request(:get, "#{KannelRails.config.kannel_url}:#{KannelRails.config.sendsms_port}/cgi-bin/sendsms?" + + "dlr-mask=31&password=#{KannelRails.config.password}" + + "&from=customsender" + + "&text=Hello%20World!&to=09101111111" + + "&username=#{KannelRails.config.username}"). + with(:headers => {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}). + to_return(:status => 200, :body => "", :headers => {}) + + KannelRails.send_message("09101111111", "Hello World!", :from => 'customsender') + end + end + end
Add test for passing extra parameters to kannel
diff --git a/spec/support/oboe_spec.rb b/spec/support/oboe_spec.rb index abc1234..def5678 100644 --- a/spec/support/oboe_spec.rb +++ b/spec/support/oboe_spec.rb @@ -1,7 +1,4 @@ require 'spec_helper' describe Oboe do - it 'should return correct version string' do - Oboe::Version::STRING.should =~ /2.0.0/ - end end
Remove the version check test. It adds no value.
diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb index abc1234..def5678 100644 --- a/config/initializers/omniauth.rb +++ b/config/initializers/omniauth.rb @@ -6,6 +6,6 @@ end provider :google_oauth2, config["providers"]["google_oauth2"]["key"], config["providers"]["google_oauth2"]["secret"], {client_options: {ssl: {ca_path: "/usr/lib/ssl/certs"}}, setup: true} - provider :facebook, config["providers"]["facebook"]["key"], config["providers"]["facebook"]["secret"], {:scope => 'email'} + provider :facebook, config["providers"]["facebook"]["key"], config["providers"]["facebook"]["secret"], { scope: 'email', info_fields: 'email'} end end
Add parameter to send through an email
diff --git a/geos-extensions.gemspec b/geos-extensions.gemspec index abc1234..def5678 100644 --- a/geos-extensions.gemspec +++ b/geos-extensions.gemspec @@ -21,6 +21,6 @@ s.homepage = "http://github.com/zoocasa/geos-extensions" s.require_paths = ["lib"] - s.add_dependency("ffi-geos", ["~> 0.1"]) + s.add_dependency("ffi-geos", [">= 0.1"]) end
Set ffi-geos dependency to >= 0.1.
diff --git a/spec/functions/split_spec.rb b/spec/functions/split_spec.rb index abc1234..def5678 100644 --- a/spec/functions/split_spec.rb +++ b/spec/functions/split_spec.rb @@ -4,7 +4,7 @@ it { should run.with_params('aoeu', 'o').and_return(['a', 'eu']) } it { should_not run.with_params('foo').and_raise_error(Puppet::DevError) } - if Puppet.version =~ /\A3\.1/ + if (Puppet.version.split('.').map { |s| s.to_i } <=> [3, 1]) >= 0 expected_error = ArgumentError else expected_error = Puppet::ParseError
Fix version comparison in function specs
diff --git a/spec/models/entry_spec.rb b/spec/models/entry_spec.rb index abc1234..def5678 100644 --- a/spec/models/entry_spec.rb +++ b/spec/models/entry_spec.rb @@ -6,6 +6,13 @@ it { should validate_length_of(:script) } let(:c) do + User.create( + name: "Bill Nye", + nickname: "The Science Guy", + provider: "foo", + image: "bar", + uid: "baz" + ) c = Challenge.new({ :title => :test, :description => :test,
Create user for Entry model spec
diff --git a/spec/matching/repeat_spec.rb b/spec/matching/repeat_spec.rb index abc1234..def5678 100644 --- a/spec/matching/repeat_spec.rb +++ b/spec/matching/repeat_spec.rb @@ -15,4 +15,18 @@ matches[1].token.should eq 'aaa' matches[1].repeated_char.should eq 'a' end + + context 'integration' do + def js_repeat_match(password) + method_invoker.eval_convert_object(%'repeat_match("#{password}")') + end + + TEST_PASSWORDS.each do |password| + it "gives back the same results for #{password}" do + js_results = js_repeat_match(password) + ruby_results = matcher.matches(password) + ruby_results.should match_js_results js_results + end + end + end end
Add passing repeat integration spec
diff --git a/spec/opal/source_map_spec.rb b/spec/opal/source_map_spec.rb index abc1234..def5678 100644 --- a/spec/opal/source_map_spec.rb +++ b/spec/opal/source_map_spec.rb @@ -0,0 +1,18 @@+require 'spec_helper' +require 'opal/source_map' + +describe Opal::SourceMap do + let(:assets) { Opal::Environment.new } + let(:asset) { assets['opal'] } + let(:source) { asset.to_s } + let(:map) { described_class.new(source, asset.pathname.to_s) } + + it 'source has the magic comments' do + described_class::FILE_REGEXP.should match(source) + described_class::LINE_REGEXP.should match(source) + end + + it 'does not blow while generating the map' do + expect { map.as_json }.not_to raise_exception + end +end
Add a basic spec for source-maps
diff --git a/spec/optional_logger_spec.rb b/spec/optional_logger_spec.rb index abc1234..def5678 100644 --- a/spec/optional_logger_spec.rb +++ b/spec/optional_logger_spec.rb @@ -4,8 +4,4 @@ it "has a version number" do expect(OptionalLogger::VERSION).not_to be nil end - - it "does something useful" do - expect(false).to eq(true) - end end
Remove the purposefully failing spec Why you made the change: I did this because now we have seen travis-ci successfully run and fail. Now we want to remove this and see travis-ci successfully run and succeed.
diff --git a/spec/unit/autoescape_spec.rb b/spec/unit/autoescape_spec.rb index abc1234..def5678 100644 --- a/spec/unit/autoescape_spec.rb +++ b/spec/unit/autoescape_spec.rb @@ -0,0 +1,49 @@+require "liquid/autoescape" +require "liquid/autoescape/configuration" + +module Liquid + describe Autoescape do + + after(:each) { Autoescape.reconfigure } + + describe ".configure" do + + it "allows autoescape settings to be customized" do + Autoescape.configure do |config| + expect(config).to be_an_instance_of(Autoescape::Configuration) + end + end + + end + + describe ".reconfigure" do + + it "undoes any user configuration" do + Autoescape.configure do |config| + config.trusted_filters << :my_custom_filter + end + + expect(Autoescape.configuration.trusted_filters).to include(:my_custom_filter) + + Autoescape.reconfigure + expect(Autoescape.configuration.trusted_filters).to_not include(:my_custom_filter) + end + + end + + describe ".configuration" do + + it "exposes the current configuration object" do + Autoescape.configure do |config| + config.global = true + end + + config = Autoescape.configuration + expect(config).to be_an_instance_of(Autoescape::Configuration) + expect(config.global?).to be(true) + end + + end + + end +end
Add forgotten specs for the top-level Autoescape module
diff --git a/modules/mjr_convert/spec/init/spec.rb b/modules/mjr_convert/spec/init/spec.rb index abc1234..def5678 100644 --- a/modules/mjr_convert/spec/init/spec.rb +++ b/modules/mjr_convert/spec/init/spec.rb @@ -2,11 +2,11 @@ describe 'mjr_convert::init' do - describe command('mjr2webm') do + describe command('which mjr2webm') do its(:exit_status) { should eq 0 } end - describe command('mjr2png') do + describe command('which mjr2png') do its(:exit_status) { should eq 0 } end
Check commands exist rather then run them
diff --git a/homebrew.rb b/homebrew.rb index abc1234..def5678 100644 --- a/homebrew.rb +++ b/homebrew.rb @@ -2,8 +2,8 @@ class Ah < Formula homepage "https://github.com/9seconds/ah" - url "https://github.com/9seconds/ah.git", :tag => "0.13.1" - version "0.13.1" + url "https://github.com/9seconds/ah.git", :tag => "0.14" + version "0.14" sha1 "" bottle do
Update HomeBrew formula to the version 0.14
diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb index abc1234..def5678 100644 --- a/app/mailers/user_mailer.rb +++ b/app/mailers/user_mailer.rb @@ -19,7 +19,7 @@ @user = User.find(user_id) @user.touch(:personal_email_sent_on) - mail from: "matt@assemblymade.com", + mail from: "austin@assemblymade.com", to: @user.email, subject: "Assembly" end
Change the from address of follow up to Austin.
diff --git a/HorizontalPickerControl.podspec b/HorizontalPickerControl.podspec index abc1234..def5678 100644 --- a/HorizontalPickerControl.podspec +++ b/HorizontalPickerControl.podspec @@ -21,7 +21,7 @@ s.platform = :ios, "8.0" - s.source = { :git => "https://github.com/acrookston/HorizontalPicker.git", :tag => "0.2.0" } + s.source = { :git => "https://github.com/acrookston/HorizontalPicker.git", :tag => "0.2.1" } s.source_files = "HorizontalPicker/*.swift" s.framework = "UIKit" end
Update tag reference in podspec
diff --git a/pronto-poper.gemspec b/pronto-poper.gemspec index abc1234..def5678 100644 --- a/pronto-poper.gemspec +++ b/pronto-poper.gemspec @@ -21,6 +21,6 @@ s.add_dependency 'pronto', '~> 0.2.0' s.add_dependency 'poper', '~> 0.0.1' - s.add_development_dependency 'rake', '~> 10.1.0' - s.add_development_dependency 'rspec', '~> 2.14.0' + s.add_development_dependency 'rake', '~> 10.3.0' + s.add_development_dependency 'rspec', '~> 3.0' end
Update rake and rspec versions
diff --git a/metadater.rb b/metadater.rb index abc1234..def5678 100644 --- a/metadater.rb +++ b/metadater.rb @@ -9,7 +9,6 @@ # Internal functions and classes require File.dirname(__FILE__) + '/lib/mediainfo.rb' -require File.dirname(__FILE__) + '/lib/exif.rb' require File.dirname(__FILE__) + '/lib/client.rb' # These are the filetypes we consider to be videos
Remove reference to deleted lib
diff --git a/lib/emcee/railtie.rb b/lib/emcee/railtie.rb index abc1234..def5678 100644 --- a/lib/emcee/railtie.rb +++ b/lib/emcee/railtie.rb @@ -4,6 +4,7 @@ require "emcee/post_processors/stylesheet_processor" require "emcee/compressors/html_compressor" require "emcee/documents/html_document" +require "emcee/resolver" module Emcee class Railtie < Rails::Railtie @@ -19,9 +20,10 @@ initializer :add_postprocessors do |app| app.assets.register_postprocessor "text/html", :web_components do |context, data| doc = Emcee::Documents::HtmlDocument.new(data) - Emcee::PostProcessors::ImportProcessor.new(context).process(doc) - Emcee::PostProcessors::ScriptProcessor.new(context).process(doc) - Emcee::PostProcessors::StylesheetProcessor.new(context).process(doc) + resolver = Emcee::Resolver.new(context) + Emcee::PostProcessors::ImportProcessor.new(resolver).process(doc) + Emcee::PostProcessors::ScriptProcessor.new(resolver).process(doc) + Emcee::PostProcessors::StylesheetProcessor.new(resolver).process(doc) doc.to_s end end
Integrate Resolver class into rail tie
diff --git a/db/migrate/20170130153424_send_correct_public_updated_at_for_cbt_manual.rb b/db/migrate/20170130153424_send_correct_public_updated_at_for_cbt_manual.rb index abc1234..def5678 100644 --- a/db/migrate/20170130153424_send_correct_public_updated_at_for_cbt_manual.rb +++ b/db/migrate/20170130153424_send_correct_public_updated_at_for_cbt_manual.rb @@ -0,0 +1,56 @@+# The History +# ----------- +# +# As part of a story to remove change notes for minor editions from the +# publishing-api we asked the users to check the published versions of +# their manuals to see if the new change history was correct. The owner +# of the CBT syllabus and guidance manual (content_id: +# ccf91c4f-6a0f-4498-8ddd-6be537df296c) let us know that the public +# timestamp was set to 14th Nov 2016, when they were sure the manual was +# actually published on 1st Dec 2016. We investigated and noticed that +# some the first_published_at was in line with what they expected (1st +# Dec 2016) but the public_updated_at was somehow set to the 14th Nov +# 2016. +# +# We can't work out why this happened, as none of the scripts run to +# tidy up change notes made changes to the public_updated_at timestamp +# of the manuals. The only thing we can think is that somehow the +# timestamp was set as part of a mistaken early publish and never updated +# afterwards. +# +# This Migration issues publishing-api commands to set the +# public_updated_at to 1st Dec 2016. +# +# Note that we only need to set the correct timestamp on the manual +# not it's documents, as only the manual timestamp is used. +class SendCorrectPublicUpdatedAtForCbtManual < Mongoid::Migration + def self.up + correct_public_timestamp = Time.zone.parse("2016-12-01T08:51:37.000+00:00") + + manual, _metadata_we_dont_need_here = ManualServiceRegistry.new.show("ccf91c4f-6a0f-4498-8ddd-6be537df296c").call + publishing_api = ManualsPublisherWiring.get(:publishing_api_v2) + + put_content = ->(content_id, payload) do + publishing_api.put_content(content_id, payload.merge( + public_updated_at: correct_public_timestamp, + first_published_at: correct_public_timestamp, + update_type: "republish" + )) + end + + # Write new drafts of the manual + manual_renderer = ManualsPublisherWiring.get(:manual_renderer) + organisation = ManualsPublisherWiring.get(:organisation_fetcher).call(manual.organisation_slug) + ManualPublishingAPIExporter.new( + put_content, organisation, manual_renderer, PublicationLog, manual + ).call + + # Publish the new draft + publishing_api.publish(manual.id, "republish") + end + + def self.down + # We can't undo this as the change lives only in the publishing-api + raise IrreversibleMigration + end +end
Send the correct public_updated_at to publishing-api for cbt manual This manual somehow has a first_published_at that is after it's current public_updated_at in the publishing-api/content-store. We don't know how it happened, but we can fix it with a republish event that sets the public_updated_at correctly.
diff --git a/lib/grn_mini/util.rb b/lib/grn_mini/util.rb index abc1234..def5678 100644 --- a/lib/grn_mini/util.rb +++ b/lib/grn_mini/util.rb @@ -9,11 +9,11 @@ end def text_snippet_from_selection_results(table, open_tag = '<<', close_tag = ">>") - table.expression.snippet([[open_tag, close_tag]]) + table.expression.snippet([[open_tag, close_tag]], {normalize: true}) end def html_snippet_from_selection_results(table, open_tag = '<strong>', close_tag = "</strong>") - table.expression.snippet([[open_tag, close_tag]], {html_escape: true}) + table.expression.snippet([[open_tag, close_tag]], {html_escape: true, normalize: true}) end end end
Add normalize option to text_snippet_from_selection_results, html_snippet_from_selection_results
diff --git a/db/seeds.rb b/db/seeds.rb index abc1234..def5678 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -6,4 +6,11 @@ # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel', city: cities.first) -Group.create(number: "48", street: "Wall Street", city: "New York", zip_code: "10005") +# Create a single group + +Group.find_or_create_by({primary_number: "48", + street_name: "Wall", + street_suffix: "St", + city_name: "New York", + state_abbreviation: "NY", + zipcode: "10005"})
Create a single group in our migration.
diff --git a/mjml-ruby.gemspec b/mjml-ruby.gemspec index abc1234..def5678 100644 --- a/mjml-ruby.gemspec +++ b/mjml-ruby.gemspec @@ -18,7 +18,7 @@ s.platform = Gem::Platform::RUBY s.require_paths = ['lib'] - s.add_runtime_dependency 'dry-configurable', '~> 0.3', '~> 0.4' + s.add_runtime_dependency 'dry-configurable', '~> 0.1', '>= 0.1.3' s.add_development_dependency 'rake' s.add_development_dependency 'minitest', '~> 5.9', '>= 5.0'
Update dry-configurable dependency to match dry-validation
diff --git a/lib/poke/controls.rb b/lib/poke/controls.rb index abc1234..def5678 100644 --- a/lib/poke/controls.rb +++ b/lib/poke/controls.rb @@ -9,7 +9,7 @@ def initialize(params) Params.check_params(params, PARAMS_REQUIRED) - + @window = params[:window] end end
Add window ivar to Controls
diff --git a/db/migrate/20120511233557_change_hadoop_instance_state_to_online.rb b/db/migrate/20120511233557_change_hadoop_instance_state_to_online.rb index abc1234..def5678 100644 --- a/db/migrate/20120511233557_change_hadoop_instance_state_to_online.rb +++ b/db/migrate/20120511233557_change_hadoop_instance_state_to_online.rb @@ -1,13 +1,13 @@ class ChangeHadoopInstanceStateToOnline < ActiveRecord::Migration def up add_column :hadoop_instances, :online, :boolean, :default => true - execute("UPDATE hadoop_instances SET online = f WHERE state <> 'online'") + execute("UPDATE hadoop_instances SET online = 'f' WHERE state <> 'online'") remove_column :hadoop_instances, :state end def down add_column :hadoop_instances, :state, :string, :default => "offline" - execute("UPDATE hadoop_instances SET state = 'online' WHERE online = t") + execute("UPDATE hadoop_instances SET state = 'online' WHERE online = 't'") remove_column :hadoop_instances, :online end end
Migrate without the usage of models
diff --git a/guides/voice/conference-calls-guide/moderated-conference/example.rb b/guides/voice/conference-calls-guide/moderated-conference/example.rb index abc1234..def5678 100644 --- a/guides/voice/conference-calls-guide/moderated-conference/example.rb +++ b/guides/voice/conference-calls-guide/moderated-conference/example.rb @@ -0,0 +1,24 @@+# Get twilio-ruby from twilio.com/docs/ruby/install +require 'rubygems' # This line not needed for ruby > 1.8 +require 'sinatra' +require 'twilio-ruby' + +# Update with your own phone number in E.164 format +MODERATOR = '+15558675309' + +post '/voice' do + # Start our TwiML response + Twilio::TwiML::Response.new do |r| + # Start with a <Dial> verb + r.Dial do |d| + if (params['From'] == MODERATOR) + # If the caller is our MODERATOR, then start the conference when they + # join and end the conference when they leave + d.Conference 'My conference', startConferenceOnEnter: true, endConferenceOnExit: true + else + # Otherwise have the caller join as a regular participant + d.Conference 'My conference', startConferenceOnEnter: false + end + end + end.text +end
Create Conference Calls in Ruby
diff --git a/lib/tasks/users.rake b/lib/tasks/users.rake index abc1234..def5678 100644 --- a/lib/tasks/users.rake +++ b/lib/tasks/users.rake @@ -1,38 +1,6 @@ # frozen_string_literal: true namespace :users do - desc 'Renames users with email-like usernames' - task remove_email_like_usernames: :environment do - target = User.where("username REGEXP '[^@]+@[^@]+'") - - STDOUT.print "About to rename #{target.size} users. Continue? (y/n)" - abort unless STDIN.gets.chomp == 'y' - - target.find_each do |user| - sanitized_username = user.username.gsub(/@.*/, '') - - new_username = if User.exists?(username: sanitized_username) - sanitized_username + '0' - else - sanitized_username - end - - user.update!(username: new_username) - end - end - - desc 'Renames users with id-like usernames' - task remove_id_like_usernames: :environment do - target = User.where("username REGEXP '^[1-9]+$'") - - STDOUT.print "About to rename #{target.size} users. Continue? (y/n)" - abort unless STDIN.gets.chomp == 'y' - - target.find_each do |user| - user.update!(username: user.email.gsub(/@.*/, '') + user.username) - end - end - desc 'Removes ads by locked users' task remove_spam_leftovers: :environment do target = Ad.joins(:user).where(users: { locked: 1 })
Remove some tasks that won't be run again
diff --git a/modules/django.rb b/modules/django.rb index abc1234..def5678 100644 --- a/modules/django.rb +++ b/modules/django.rb @@ -8,8 +8,7 @@ depend :remote, :command, "#{python}" def django_manage(cmd, options={}) - puts options - path = options.delete(:path) or "#{latest_release}" + path = options.delete(:path) || "#{latest_release}" run "cd #{path}/#{django_project_subdirectory}; #{python} manage.py #{cmd}" end
Use correct form of "or" operator.
diff --git a/better_open_struct.gemspec b/better_open_struct.gemspec index abc1234..def5678 100644 --- a/better_open_struct.gemspec +++ b/better_open_struct.gemspec @@ -1,5 +1,4 @@ # -*- encoding: utf-8 -*- -require File.expand_path('../lib/better_open_struct/version', __FILE__) Gem::Specification.new do |gem| gem.authors = ["Ryan Closner"]
Remove line referencing deleted file
diff --git a/db/migrate/20160616102642_remove_duplicated_keys.rb b/db/migrate/20160616102642_remove_duplicated_keys.rb index abc1234..def5678 100644 --- a/db/migrate/20160616102642_remove_duplicated_keys.rb +++ b/db/migrate/20160616102642_remove_duplicated_keys.rb @@ -9,7 +9,7 @@ AND id != ( SELECT id FROM ( SELECT max(id) AS id - FROM keys + FROM #{quote_table_name(:keys)} WHERE fingerprint = #{fingerprint} ) max_ids )
Fix broken migration in MySQL Closes #19344
diff --git a/db/migrate/20170313104058_adjust_sent_validation.rb b/db/migrate/20170313104058_adjust_sent_validation.rb index abc1234..def5678 100644 --- a/db/migrate/20170313104058_adjust_sent_validation.rb +++ b/db/migrate/20170313104058_adjust_sent_validation.rb @@ -0,0 +1,41 @@+class AdjustSentValidation < ActiveRecord::Migration + def up + execute %Q{ +CREATE OR REPLACE FUNCTION public.sent_validation() + RETURNS trigger + LANGUAGE plpgsql +AS $function$ + BEGIN + IF state_order(new) >= 'sent'::project_state_order THEN + PERFORM assert_not_null(new.about_html, 'about_html'); + PERFORM assert_not_null(new.headline, 'headline'); + IF EXISTS (SELECT true FROM users u WHERE u.id = new.user_id AND u.name IS NULL) THEN + RAISE EXCEPTION $$name of project owner can't be null$$; + END IF; + END IF; + RETURN null; + END; + $function$; +} + end + + def down + execute %Q{ +CREATE OR REPLACE FUNCTION public.sent_validation() + RETURNS trigger + LANGUAGE plpgsql +AS $function$ + BEGIN + IF state_order(new) >= 'sent'::project_state_order THEN + PERFORM assert_not_null(new.about_html, 'about_html'); + PERFORM assert_not_null(new.headline, 'headline'); + IF EXISTS (SELECT true FROM users u WHERE u.id = new.user_id AND u.public_name IS NULL) THEN + RAISE EXCEPTION $$name of project owner can't be null$$; + END IF; + END IF; + RETURN null; + END; + $function$; +} + end +end
Validate user.name on sent state
diff --git a/config/initializers/hydrant_config.rb b/config/initializers/hydrant_config.rb index abc1234..def5678 100644 --- a/config/initializers/hydrant_config.rb +++ b/config/initializers/hydrant_config.rb @@ -10,4 +10,4 @@ content_preview = IngestStep.new('preview', 'Preview and publish', 'Release the item for use', 'preview') - HYDRANT_STEPS = IngestWorkflow.new(metadata, file_upload, structure, access_control, content_preview) + HYDRANT_STEPS = IngestWorkflow.new(file_upload, metadata, structure, access_control, content_preview)
Put file_upload back at beginning of workflow until we figure out a better workflow and fix assumptions in tests
diff --git a/config/initializers/show_constants.rb b/config/initializers/show_constants.rb index abc1234..def5678 100644 --- a/config/initializers/show_constants.rb +++ b/config/initializers/show_constants.rb @@ -1,10 +1,10 @@ CURRENT_TOP_ROW_VALUES = [200, 400].freeze PLAY_TYPES = { + "college" => "College Championship", "regular" => "regular play", "toc" => "Tournament of Champions", "teachers" => "Teachers Tournament", - "college" => "College Championship", "teen" => "Teen Tournament", "power" => "Power Players Week", "celebrity" => "Celebrity",
Move College Championship to top of play-type list
diff --git a/config/initializers/show_constants.rb b/config/initializers/show_constants.rb index abc1234..def5678 100644 --- a/config/initializers/show_constants.rb +++ b/config/initializers/show_constants.rb @@ -1,11 +1,11 @@ CURRENT_TOP_ROW_VALUES = [200, 400].freeze PLAY_TYPES = { + "teachers" => "Teachers Tournament", "regular" => "regular play", "college" => "College Championship", "teen" => "Teen Tournament", "power" => "Power Players Week", - "teachers" => "Teachers Tournament", "toc" => "Tournament of Champions", "celebrity" => "Celebrity", "kids" => "Kids Week / Back to School Week",
Move Teachers Tournament to top of play-type list
diff --git a/lib/generators/devise_materialize/install_generator.rb b/lib/generators/devise_materialize/install_generator.rb index abc1234..def5678 100644 --- a/lib/generators/devise_materialize/install_generator.rb +++ b/lib/generators/devise_materialize/install_generator.rb @@ -6,16 +6,16 @@ source_root File.expand_path("../../templates", __FILE__) desc "Creates a Devise Materialize Styled Views" - argument :namespace, type: :string, default: "Users" + argument :namespace, type: :string, default: "Devise" class_option :form_engine, type: :string, default: "default", - description: "Define if simple form is used " \ - "to load views built with simple form" - class_option :view_engine, type: :string, default: "erb", alias: "-e", - description: "Choose a template engine " \ - "from erb, haml, or slim" + description: "Choose a form engine " \ + "(default or simple_form)" + class_option :view_engine, type: :string, default: "erb", + description: "Choose a views engine " \ + "(erb, haml, or slim)" def generate_views - puts "Generating Views ....." + puts "Generating Views....." directory "#{options.view_engine.downcase}/#{options.form_engine}", "app/views/#{namespace.downcase}" end
Update default namespace to Devise instead of User
diff --git a/ovaltine.gemspec b/ovaltine.gemspec index abc1234..def5678 100644 --- a/ovaltine.gemspec +++ b/ovaltine.gemspec @@ -23,6 +23,6 @@ spec.require_paths = ["lib"] spec.add_development_dependency "bundler", "~> 1.3" - spec.add_development_dependency "rake" - spec.add_development_dependency "bacon" + spec.add_development_dependency "rake", '~> 10.0' + spec.add_development_dependency "bacon", '~> 1.2' end
Make development dependencies more specific
diff --git a/noir.gemspec b/noir.gemspec index abc1234..def5678 100644 --- a/noir.gemspec +++ b/noir.gemspec @@ -20,7 +20,7 @@ spec.required_ruby_version = '>= 1.9.2' - spec.add_development_dependency 'bundler', '~> 1.7' + spec.add_development_dependency 'bundler', '~> 1.6' spec.add_development_dependency 'rake', '10.4.2' spec.add_development_dependency 'rspec', '3.2.0' spec.add_development_dependency 'pry', '0.10.1'
Downgrade bundler version for compatible to 2.1.2
diff --git a/lita-weather.gemspec b/lita-weather.gemspec index abc1234..def5678 100644 --- a/lita-weather.gemspec +++ b/lita-weather.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |spec| spec.name = "lita-weather" - spec.version = "0.0.2" + spec.version = "0.0.3" spec.authors = ["Mitch Dempsey"] spec.email = ["mrdempsey@gmail.com"] spec.description = %q{A Lita handler that provides current weather conditions} @@ -13,11 +13,11 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] - spec.add_runtime_dependency "lita", "~> 2.3" + spec.add_runtime_dependency "lita", ">= 2.3" spec.add_development_dependency "bundler", "~> 1.3" spec.add_development_dependency "rake" - spec.add_development_dependency "rspec", ">= 2.14" + spec.add_development_dependency "rspec", ">= 3.0.0.beta2" spec.add_development_dependency "simplecov" spec.add_development_dependency "coveralls"
Update gemspec for Lita 3.0 compatibility.
diff --git a/spec/requests/styleguide_spec.rb b/spec/requests/styleguide_spec.rb index abc1234..def5678 100644 --- a/spec/requests/styleguide_spec.rb +++ b/spec/requests/styleguide_spec.rb @@ -0,0 +1,30 @@+RSpec.describe 'Styleguide', type: :request do + describe 'styleguide pages' do + routes = Rails.application.routes.routes.map do |route| + path = route.path.spec.to_s + path.sub(/\(.:format\)/, '') if path =~ /styleguide/ && path !~ /:action/ + end.compact + + routes.each do |route| + it "gives a 200 for each styleguide page #{route}" do + get route + expect(response.status).to eq(200) + end + end + end + + describe 'styleguide component pages' do + components = Dir[Rails.root.join('app', 'views', 'styleguide', '*.html.erb')].map do |f| + File.basename(f, '.html.erb') + end + + components.each do |component| + route = "/styleguide/#{component}" + + it "gives a 200 for each styleguide component page #{route}" do + get route + expect(response.status).to eq(200) + end + end + end +end
Check that each styleguide page gives a 200
diff --git a/test/beantool_test.rb b/test/beantool_test.rb index abc1234..def5678 100644 --- a/test/beantool_test.rb +++ b/test/beantool_test.rb @@ -1,7 +1,7 @@-require 'test/unit' +require 'minitest/autorun' require File.join(File.dirname(__FILE__), '..', 'lib', 'beantool') -class BeantoolTest < Test::Unit::TestCase +class BeantoolTest < MiniTest::Test def setup @beantool = Beantool.new(['localhost:11300']) end
Update tests to use MiniTest
diff --git a/jekyll-theme-feeling-responsive.gemspec b/jekyll-theme-feeling-responsive.gemspec index abc1234..def5678 100644 --- a/jekyll-theme-feeling-responsive.gemspec +++ b/jekyll-theme-feeling-responsive.gemspec @@ -0,0 +1,23 @@+Gem::Specification.new do |s| + s.name = 'jekyll-theme-feeling-responsive' + s.version = '1.0.0' + s.date = '2017-10-09' + s.summary = 'a free flexible theme for Jekyll built on Foundation framework' + s.description = <<-EOD== +# Feeling Responsive +Is a free flexible theme for Jekyll built on Foundation framework. +You can use it for your company site, as a portfolio or as a blog. + +See the [home page](http://phlow.github.io/feeling-responsive/) to get a +look at the theme and read about its features. + +See the [documentation](http://phlow.github.io/feeling-responsive/documentation/) +to learn how to use the theme effectively in your Jekyll site. + EOD + s.authors = ['Moritz Sauer', 'Douglas Lovell'] + s.email = ['https://phlow.de/kontakt.html', 'doug@wbreeze.com'] + s.files = `git ls-files -z`.split("\x0").select { |f| f.match(%r{^(assets|_layouts|_includes|_sass|LICENSE|README)}i) } + s.homepage = 'http://phlow.github.io/feeling-responsive/' + s.license = 'MIT' +end +
Add gemspec for version 1.0.0
diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index abc1234..def5678 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -11,4 +11,30 @@ expect(helper.login_strategy).to be :developer end end + + describe 'title_for' do + context 'a model with a name' do + let(:model) { build(:import, name: 'My Import') } + + it 'returns the model name' do + expect(helper.title_for(model)).to eq model.name + end + end + + context 'a model with no name' do + let(:model) { build(:import, name: nil) } + + it 'returns "Untitled"' do + expect(helper.title_for(model)).to eq 'Untitled' + end + end + + context 'with a property other than name' do + let(:model) { build(:user) } + + it 'returns the value of that property' do + expect(helper.title_for(model, :email)).to eq model.email + end + end + end end
Add test for title_for method in application helper
diff --git a/spec/views/images/show.html.erb_spec.rb b/spec/views/images/show.html.erb_spec.rb index abc1234..def5678 100644 --- a/spec/views/images/show.html.erb_spec.rb +++ b/spec/views/images/show.html.erb_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe "images/show" do +describe "images/show", :type => :feature do before(:each) do @image = assign(:image, stub_model(Image)) end @@ -9,4 +9,10 @@ render # Run the generator again with the --webrat flag if you want to use webrat matchers end + + it 'has a correct image' do + img = page.first(:css, '#fullsize_image') + visit img[:src] + page.status_code.should be 200 + end end
Test image has correct source
diff --git a/lib/arel.rb b/lib/arel.rb index abc1234..def5678 100644 --- a/lib/arel.rb +++ b/lib/arel.rb @@ -1,13 +1,7 @@-$LOAD_PATH.unshift(File.dirname(__FILE__)) - -require 'rubygems' -require 'active_support' -require 'active_support/dependencies' -require 'active_support/core_ext/class/attribute_accessors' -require 'active_support/core_ext/module/delegation' require 'active_record' require 'active_record/connection_adapters/abstract/quoting' +$LOAD_PATH.unshift(File.dirname(__FILE__)) require 'arel/algebra' require 'arel/engines' require 'arel/session'
Remove explicit rubygems require. Use Active Support provided by Active Record. Add self to load path after requiring Active Record.
diff --git a/config/initializers/figaro.rb b/config/initializers/figaro.rb index abc1234..def5678 100644 --- a/config/initializers/figaro.rb +++ b/config/initializers/figaro.rb @@ -0,0 +1,6 @@+# Define the environment variables that should be set in config/application.yml. +# See config/application.example.yml if you don't have config/application.yml. +Figaro.require('API_PATH') unless ENV['API_SUBDOMAIN'].present? +Figaro.require('ADMIN_PATH') unless ENV['ADMIN_SUBDOMAIN'].present? +Figaro.require('DEFAULT_PER_PAGE') +Figaro.require('MAX_PER_PAGE')
Raise error when required config vars are not set. Closes #180.
diff --git a/config/software/sequel-gem.rb b/config/software/sequel-gem.rb index abc1234..def5678 100644 --- a/config/software/sequel-gem.rb +++ b/config/software/sequel-gem.rb @@ -0,0 +1,30 @@+# +# Copyright 2012-2014 Chef Software, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +name "sequel-gem" +default_version "4.13.0" + +dependency "ruby" +dependency "rubygems" + +build do + env = with_standard_compiler_flags(with_embedded_path) + + gem "install sequel" \ + " --version '#{version}'" \ + " --bindir '#{install_dir}/embedded/bin'" \ + " --no-ri --no-rdoc", env: env +end
Add definition for sequel gem
diff --git a/argumentative.rb b/argumentative.rb index abc1234..def5678 100644 --- a/argumentative.rb +++ b/argumentative.rb @@ -41,7 +41,7 @@ private def match?(types) - @args.zip(types).all? { |arg, type| arg.is_a?(type) } + types.count == @args.count && @args.zip(types).all? { |arg, type| arg.is_a?(type) } end end end
Check count before matching argument types
diff --git a/lib/acts_as_content_node/publishable.rb b/lib/acts_as_content_node/publishable.rb index abc1234..def5678 100644 --- a/lib/acts_as_content_node/publishable.rb +++ b/lib/acts_as_content_node/publishable.rb @@ -5,7 +5,7 @@ def acts_as_publishable send :include, InstanceMethods - named_scope :published, lambda { { :conditions => ["(published_at IS NOT NULL AND published_at != '') AND published_at < ? AND (published_to > ? OR published_to IS NULL OR published_to = '')", Time.now, Time.now] } } + named_scope :published, lambda { { :conditions => ["(published_at IS NOT NULL AND published_at != '') AND published_at <= ? AND (published_to > ? OR published_to IS NULL OR published_to = '')", Time.now, Time.now] } } named_scope :draft, :conditions => { :published_at => nil } before_save :set_published
Tweak to published name scope
diff --git a/lib/chef_fs/file_system/data_bag_dir.rb b/lib/chef_fs/file_system/data_bag_dir.rb index abc1234..def5678 100644 --- a/lib/chef_fs/file_system/data_bag_dir.rb +++ b/lib/chef_fs/file_system/data_bag_dir.rb @@ -11,6 +11,15 @@ @exists = nil end + def dir? + exists? + end + + def read + # This will only be called if dir? is false, which means exists? is false. + raise ChefFS::FileSystem::NotFoundException, path_for_printing + end + def exists? if @exists.nil? @exists = parent.children.any? { |child| child.name == name }
Make data_bags/README.md diff instead of show "is a directory"
diff --git a/app/helpers/followers_helper.rb b/app/helpers/followers_helper.rb index abc1234..def5678 100644 --- a/app/helpers/followers_helper.rb +++ b/app/helpers/followers_helper.rb @@ -16,6 +16,6 @@ end def build_invite_mailto(section, user) - "mailto:?subject=#{Rack::Utils.escape(t('welcome_email.subject'))}&body=#{Rack::Utils.escape(t('welcome_email.body', link: student_user_new_url(section_code: section.code), name: user.name))}" + "mailto:?subject=#{Rack::Utils.escape_path(t('welcome_email.subject'))}&body=#{Rack::Utils.escape_path(t('welcome_email.body', link: student_user_new_url(section_code: section.code), name: user.name))}" end end
Use escape_path rather than escape when encoding mailto: line Utils.escape will encode space to +. Utils.escape_path encodes space to %20. While Gmail seems to handle pluses just fine, Outlook does not, and message will have spaces through subject and body. Using escape_path should fix this for Outlook. Tested on Windows 7 with Chrome 32 (Gmail + Outlook), FF25, and IE11. Fixes #211
diff --git a/core/range/initialize_spec.rb b/core/range/initialize_spec.rb index abc1234..def5678 100644 --- a/core/range/initialize_spec.rb +++ b/core/range/initialize_spec.rb @@ -25,4 +25,12 @@ lambda { (1..3).__send__(:initialize, 1, 3, 5, 7, 9) }. should raise_error(ArgumentError) end + + it "raises an ArgumentError if arguments don't respond to <=> but are Comparable" do + o1 = Object.new + o1.extend(Comparable) + o2 = Object.new + o2.extend(Comparable) + lambda { Range.new(o1, o2) }.should raise_error(ArgumentError) + end end
Add spec for comparable with Range and no <=> method defined
diff --git a/lib/mrb/scripts/expression_rewriters.rb b/lib/mrb/scripts/expression_rewriters.rb index abc1234..def5678 100644 --- a/lib/mrb/scripts/expression_rewriters.rb +++ b/lib/mrb/scripts/expression_rewriters.rb @@ -8,7 +8,8 @@ end def classes - rewriters_table = Context.instance["rewriters"] + rewriters_table_name = Conf["expression_rewriter.table"] || "rewriters" + rewriters_table = Context.instance[rewriters_table_name] return [] if rewriters_table.nil? rewriters_table.collect do |id|
Make expression rewriters table name customizable
diff --git a/lib/square/connect/connections/items.rb b/lib/square/connect/connections/items.rb index abc1234..def5678 100644 --- a/lib/square/connect/connections/items.rb +++ b/lib/square/connect/connections/items.rb @@ -32,6 +32,7 @@ end def apply_fee_to_item(item_id, fee_id) + access_token_required! item = Item.new( item_id, merchant_id: identifier,
Make sure to set access token
diff --git a/lib/feed.rb b/lib/feed.rb index abc1234..def5678 100644 --- a/lib/feed.rb +++ b/lib/feed.rb @@ -1,10 +1,17 @@ class Feed + include Enumerable attr_accessor :feed def initialize(raw_feed) @feed = [] add(raw_feed) end + + def each(&block) + @feed.each do |tweet| + block.call(tweet) + end + end def add(raw_feed) @feed = @feed + clean_feed(raw_feed)
Make Feed class include Enumerable
diff --git a/lib/three_little_pigs/objects/building_materials.rb b/lib/three_little_pigs/objects/building_materials.rb index abc1234..def5678 100644 --- a/lib/three_little_pigs/objects/building_materials.rb +++ b/lib/three_little_pigs/objects/building_materials.rb @@ -14,7 +14,9 @@ end def combined_strength(materials) - materials.reduce(0) { |acc, material| acc += material.strength } + materials.reduce(0) do |total_strength, material| + total_strength + material.strength + end end end end
Remove un-needed assignment from inside reduce
diff --git a/scio.rb b/scio.rb index abc1234..def5678 100644 --- a/scio.rb +++ b/scio.rb @@ -20,7 +20,7 @@ fi done - CLASSPATH=#{libexec}/"scio-repl-#{version}.jar":$CLASSPATH exec java ${java_opts[*]} ${scio_opts[*]} java com.spotify.scio.repl.ScioShell + CLASSPATH=#{libexec}/"scio-repl-#{version}.jar":$CLASSPATH exec java ${java_opts[*]} ${scio_opts[*]} com.spotify.scio.repl.ScioShell EOS end
Fix previous commit - remove extra
diff --git a/lib/rory.rb b/lib/rory.rb index abc1234..def5678 100644 --- a/lib/rory.rb +++ b/lib/rory.rb @@ -11,14 +11,19 @@ extend self attr_accessor :root + attr_accessor :autoload_paths + + def add_autoload_paths(paths) + @autoload_paths ||= [] + @autoload_paths += paths + end def autoload_all_files - ( - Dir[File.join(@root, 'models', '*.rb')] + - Dir[File.join(@root, 'presenters', '*.rb')] + - Dir[File.join(@root, 'helpers', '*.rb')] - ).each do |path| - autoload_file(path) + paths = (@autoload_paths || []) + %w(models presenters helpers) + paths.each do |path| + Dir[File.join(@root, path, '*.rb')].each do |file| + autoload_file file + end end end @@ -32,4 +37,4 @@ name = extract_class_name_from_path(path) Object.autoload name.to_sym, path end -end+end
Add ability to autoload arbitrary paths
diff --git a/lib/seam.rb b/lib/seam.rb index abc1234..def5678 100644 --- a/lib/seam.rb +++ b/lib/seam.rb @@ -6,4 +6,11 @@ Dir[File.dirname(__FILE__) + '/seam/*.rb'].each {|file| require file } module Seam + + def self.steps_to_run + Seam::Persistence.find_something_to_do + .group_by { |x| x.next_step } + .map { |x| x[0] } + end + end
Add method that returns steps that need to be executed.
diff --git a/Library/Homebrew/formula_specialties.rb b/Library/Homebrew/formula_specialties.rb index abc1234..def5678 100644 --- a/Library/Homebrew/formula_specialties.rb +++ b/Library/Homebrew/formula_specialties.rb @@ -9,10 +9,9 @@ # See browser for an example class GithubGistFormula < ScriptFileFormula - def initialize(*) - url = self.class.stable.url - self.class.stable.version(File.basename(File.dirname(url))[0,6]) + def self.url(val) super + version File.basename(File.dirname(val))[0, 6] end end
Implement GithubGistFormula in a more natural way
diff --git a/kramdown_monkeypatch.rb b/kramdown_monkeypatch.rb index abc1234..def5678 100644 --- a/kramdown_monkeypatch.rb +++ b/kramdown_monkeypatch.rb @@ -10,11 +10,11 @@ @base_url_as_uri ||= URI.parse(@options[:base_url]) end - def add_link(el, href, title, alt_text = nil) + def add_link(el, href, title, alt_text = nil, ial = nil) if @options[:absolute_urls] and URI.parse(href).relative? href = base_url_as_uri.merge(href).to_s end - old_add_link(el, href, title, alt_text) + old_add_link(el, href, title, alt_text, ial) end end
Update Kramdown monkeypatch for compatibility. A recent Kramdown update has added another parameter to the add_link function that is being hijacked in the monkeypatch, so this needs to be added to the function signature and passed through.
diff --git a/spec/playlist/content_details_spec.rb b/spec/playlist/content_details_spec.rb index abc1234..def5678 100644 --- a/spec/playlist/content_details_spec.rb +++ b/spec/playlist/content_details_spec.rb @@ -9,7 +9,7 @@ specify 'return all content details data with one HTTP call' do expect(Net::HTTP).to receive(:start).once.and_call_original - expect(playlist.item_count).to be 3 + expect(playlist.item_count).to be 52 end end end
Fix tests: items in test playlist have changed
diff --git a/lib/absorb/amazon_s3.rb b/lib/absorb/amazon_s3.rb index abc1234..def5678 100644 --- a/lib/absorb/amazon_s3.rb +++ b/lib/absorb/amazon_s3.rb @@ -6,6 +6,7 @@ def initialize options @options = options @bucket_name = options[:bucket_name] + setup end def setup @@ -16,14 +17,11 @@ end def delete_bucket - setup AWS::S3::Bucket.delete(bucket_name, force: true) rescue end def store_file file - setup - begin AWS::S3::Bucket.create(bucket_name) rescue
Move the setup to the s3 constructor.
diff --git a/app/controllers/admin/themes_controller.rb b/app/controllers/admin/themes_controller.rb index abc1234..def5678 100644 --- a/app/controllers/admin/themes_controller.rb +++ b/app/controllers/admin/themes_controller.rb @@ -11,7 +11,8 @@ def switchto - setting = Setting.find_by_name('theme') + setting = (Setting.find_by_name('theme') or Setting.new("name" => 'theme')) + setting.value = params[:theme] setting.save
Create new setting in ThemesController if a 'theme' setting doesn't already exist git-svn-id: 70ab0960c3db1cbf656efd6df54a8f3de72dc710@427 820eb932-12ee-0310-9ca8-eeb645f39767
diff --git a/app/controllers/delayed_jobs_controller.rb b/app/controllers/delayed_jobs_controller.rb index abc1234..def5678 100644 --- a/app/controllers/delayed_jobs_controller.rb +++ b/app/controllers/delayed_jobs_controller.rb @@ -8,39 +8,54 @@ @job = Delayed::Job.find(params[:id]) render :layout =>nil rescue ActiveRecord::RecordNotFound => rnf - render :text =>"Not found, maybe it finished?" - return - - #handle Exception => e - # puts e - #rescue - # # render :text =>"Not found, maybe it finished?" - # # return + render :text => "Not found, maybe it finished?" end end def counts - @wip_counts = Delayed::Job.where("locked_by is not null").length - @failing_counts = Delayed::Job.where("attempts > 1").length - @overdue_counts = Delayed::Job.where("run_at < ?", Time.now).length - @future_counts = Delayed::Job.where("run_at >= ?", Time.now).length + @wip_counts = wip_jobs.count + @failing_counts = failing_jobs.count + @overdue_counts = overdue_jobs.count + @future_counts = future_jobs.count end def wip - @jobs = Delayed::Job.where("locked_by is not null") + @jobs = wip_jobs render :layout =>nil end def failing - @jobs = Delayed::Job.where("attempts > 1") + @jobs = failing_jobs render :layout =>nil - end def overdue - @jobs = Delayed::Job.where("run_at < ?", Time.now) + @jobs = overdue_jobs render :layout =>nil end def future - @jobs = Delayed::Job.where("run_at >= ?", Time.now) + @jobs = future_jobs render :layout =>nil + end + private + + def wip_jobs + Delayed::Job. + where("locked_by is not null"). + where("attempts < ?", Delayed::Worker.max_attempts) end -end+ def failing_jobs + Delayed::Job. + where("attempts >= 1"). + where("locked_by is null"). + where("failed_at is not null") + end + def overdue_jobs + Delayed::Job. + where("run_at < ?", Time.now). + where("locked_by is null"). + where("failed_at is null") + end + def future_jobs + Delayed::Job. + where("run_at >= ?", Time.now) + end +end
Tweak the queries for the different classifications.
diff --git a/app/helpers/feeder/authorization_helper.rb b/app/helpers/feeder/authorization_helper.rb index abc1234..def5678 100644 --- a/app/helpers/feeder/authorization_helper.rb +++ b/app/helpers/feeder/authorization_helper.rb @@ -1,11 +1,15 @@ module Feeder module AuthorizationHelper + def can_contribute? + Feeder.config.current_user_method.present? + end + def can_recommend?(item) - authorization_adapter.authorized? :recommend, item + can_contribute? && authorization_adapter.authorized?(:recommend, item) end def can_like?(item) - authorization_adapter.authorized? :like, item + can_contribute? && authorization_adapter.authorized?(:like, item) end def authorization_adapter
Check whether current_user_method is even configured before doing anything else
diff --git a/lib/delayed_cron_job.rb b/lib/delayed_cron_job.rb index abc1234..def5678 100644 --- a/lib/delayed_cron_job.rb +++ b/lib/delayed_cron_job.rb @@ -10,10 +10,10 @@ if defined?(Delayed::Backend::Mongoid) Delayed::Backend::Mongoid::Job.field :cron, :type => String - Delayed::Backend::Mongoid::Job.attr_accessible(:cron) + Delayed::Backend::Mongoid::Job.attr_accessible(:cron) if Delayed::Backend::Mongoid::Job.respond_to?(:attr_accessible) end -if defined?(Delayed::Backend::ActiveRecord) +if defined?(Delayed::Backend::ActiveRecord) && Delayed::Backend::ActiveRecord::Job.respond_to?(:attr_accessible) Delayed::Backend::ActiveRecord::Job.attr_accessible(:cron) end
Check if class responds to method before calling it
diff --git a/lib/rbuv.rb b/lib/rbuv.rb index abc1234..def5678 100644 --- a/lib/rbuv.rb +++ b/lib/rbuv.rb @@ -7,22 +7,33 @@ module Rbuv class << self - def run_loop - Loop.default.run - end - + # Stop the default loop. + # @see Rbuv::Loop#stop + # @return [Rbuv::Loop] the {Rbuv::Loop.default} def stop_loop Loop.default.stop end alias stop stop_loop - def run(&block) + # Run the default loop. + # @see Rbuv::Loop#run + # @yield (see Rbuv::Loop#run) + # @yieldparam loop [Rbuv::Loop] the {Rbuv::Loop.default} + # @return [Rbuv::Loop] the {Rbuv::Loop.default} + def run_loop(&block) Loop.default.run(&block) end - def run_block - Loop.default.run_once { yield } + alias run run_loop + + # Run the default loop once. + # @see Rbuv::Loop#run_once + # @yield (see Rbuv::Loop#run_once) + # @yieldparam loop [Rbuv::Loop] the {Rbuv::Loop.default} + # @return [Rbuv::Loop] the {Rbuv::Loop.default} + def run_block(&block) + Loop.default.run_once(&block) end end
Add documentation for module Rbuv
diff --git a/lib/snmp.rb b/lib/snmp.rb index abc1234..def5678 100644 --- a/lib/snmp.rb +++ b/lib/snmp.rb @@ -8,3 +8,4 @@ # require 'snmp/manager' +require 'snmp/version'
Load version module by default
diff --git a/lib/acts_as_interval/acts_as_interval.rb b/lib/acts_as_interval/acts_as_interval.rb index abc1234..def5678 100644 --- a/lib/acts_as_interval/acts_as_interval.rb +++ b/lib/acts_as_interval/acts_as_interval.rb @@ -27,8 +27,6 @@ define_method "overlapping_#{klass_name}" do self.class.where("TIMEDIFF(#{start_field}, :my_end) * TIMEDIFF(:my_start, #{end_field}) >= 0", my_start: self.send(start_field), my_end: self.send(end_field)).where.not(id: self.id) end - alias_method :intervals_before, "past_#{klass_name}" - alias_method :intervals_after, "future_#{klass_name}" end end end
Drop the alias methods, no longer needed
diff --git a/lib/ooxml_parser/common_parser/parser.rb b/lib/ooxml_parser/common_parser/parser.rb index abc1234..def5678 100644 --- a/lib/ooxml_parser/common_parser/parser.rb +++ b/lib/ooxml_parser/common_parser/parser.rb @@ -6,8 +6,8 @@ def self.parse(path_to_file) return nil if OOXMLDocumentObject.encrypted_file?(path_to_file) path_to_zip_file = OOXMLDocumentObject.copy_file_and_rename_to_zip(path_to_file) - OOXMLDocumentObject.unzip_file(path_to_zip_file, path_to_zip_file.sub(File.basename(path_to_zip_file), '')) OOXMLDocumentObject.path_to_folder = path_to_zip_file.sub(File.basename(path_to_zip_file), '') + OOXMLDocumentObject.unzip_file(path_to_zip_file, OOXMLDocumentObject.path_to_folder) model = yield model.file_path = path_to_file FileUtils.remove_dir(OOXMLDocumentObject.path_to_folder)
Remove duplicate calls of path_to_folder
diff --git a/oled-control.gemspec b/oled-control.gemspec index abc1234..def5678 100644 --- a/oled-control.gemspec +++ b/oled-control.gemspec @@ -1,10 +1,13 @@ Gem::Specification.new do |s| s.name = 'oled-control' - s.version = '0.1.0' + s.version = '0.1.1' s.date = '2016-03-10' s.summary = 'Control OLED i2c display' + s.description = 'Ruby Gem for SSD1311 based 20x4 OLED display' s.authors = ['Christian Lønaas'] + s.licenses= ['MIT'] s.email = 'christian.lonaas@discombobulator.org' + s.homepage = 'https://github.com/sokkalf/oled-control' s.files = Dir.glob('lib/**/*.rb') + Dir.glob('ext/**/*.{c,h,rb}') s.extensions = ['ext/oled-control/extconf.rb']
Update gemspec for RubyGems release, set version to 0.1.1
diff --git a/app/models/manual_with_publish_tasks.rb b/app/models/manual_with_publish_tasks.rb index abc1234..def5678 100644 --- a/app/models/manual_with_publish_tasks.rb +++ b/app/models/manual_with_publish_tasks.rb @@ -2,9 +2,9 @@ class ManualWithPublishTasks < SimpleDelegator - def initialize(manual, attrs) + def initialize(manual, publish_tasks:) super(manual) - @publish_tasks = attrs.fetch(:publish_tasks) + @publish_tasks = publish_tasks end def publish_tasks
Use Ruby keyword args in ManualWithPublishTasks I think that using language features instead of custom code makes this easier to understand.
diff --git a/app/serializers/api/image_serializer.rb b/app/serializers/api/image_serializer.rb index abc1234..def5678 100644 --- a/app/serializers/api/image_serializer.rb +++ b/app/serializers/api/image_serializer.rb @@ -1,8 +1,16 @@ class Api::ImageSerializer < ActiveModel::Serializer - attributes :id, :alt, :small_url, :large_url + attributes :id, :alt, :thumb_url, :small_url, :image_url, :large_url + + def thumb_url + object.attachment.url(:mini, false) + end def small_url object.attachment.url(:small, false) + end + + def image_url + object.attachment.url(:product, false) end def large_url
Update ImageSerializer with missing image size urls: mini/thumb_url, product/image_url that is used in the product image modal
diff --git a/omnibus_overrides.rb b/omnibus_overrides.rb index abc1234..def5678 100644 --- a/omnibus_overrides.rb +++ b/omnibus_overrides.rb @@ -19,4 +19,4 @@ override "xproto", version: "7.0.28" override "zlib", version: "1.2.11" override "libzmq", version: "4.0.5" -override "openssl", version: "1.0.2j" +override "openssl", version: "1.1.0f"
Use OpenSSL 1.1.0f for new crypto functionality There's a nice list of new functionality in the 1.1 release. https://www.openssl.org/news/openssl-1.1.0-notes.html Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
diff --git a/spec/beso/job_spec.rb b/spec/beso/job_spec.rb index abc1234..def5678 100644 --- a/spec/beso/job_spec.rb +++ b/spec/beso/job_spec.rb @@ -12,11 +12,13 @@ describe 'to_csv' do subject { Beso::Job.new :message_sent, :table => :users } - let!( :user ){ User.create :name => 'Foo Bar' } + let!( :foo ){ User.create! :name => 'Foo' } + let!( :bar ){ User.create! :name => 'Bar' } its( :to_csv ){ should eq( <<-EOS Identity,Timestamp,Event -1,#{user.created_at.to_i},Message Sent +#{foo.id},#{foo.created_at.to_i},Message Sent +#{bar.id},#{bar.created_at.to_i},Message Sent EOS ) } end
Add another record to the csv example
diff --git a/spec/whiteout_spec.rb b/spec/whiteout_spec.rb index abc1234..def5678 100644 --- a/spec/whiteout_spec.rb +++ b/spec/whiteout_spec.rb @@ -9,8 +9,13 @@ Whiteout.clean("bar\t\t\n").should eql("bar\n") end - it "leaves non-trailing whitespace in tact" do + it "leaves non-trailing whitespace intact" do baz = "\t\tbaz baz\n" + Whiteout.clean(baz).should eql(baz) + end + + it "leaves consecutive newlines intact" do + baz = "foo\n\nbar\b" Whiteout.clean(baz).should eql(baz) end
Add key test we're failing
diff --git a/spec/requests/pages/servicedown_spec.rb b/spec/requests/pages/servicedown_spec.rb index abc1234..def5678 100644 --- a/spec/requests/pages/servicedown_spec.rb +++ b/spec/requests/pages/servicedown_spec.rb @@ -0,0 +1,85 @@+require 'rails_helper' + +RSpec.describe 'Servicedown mode', type: :request do + before do + allow(Settings).to receive(:maintenance_mode_enabled?).and_return(true) + Rails.application.reload_routes! + end + + after do + allow(Settings).to receive(:maintenance_mode_enabled?).and_return(false) + Rails.application.reload_routes! + end + + shared_examples 'maintenance page' do + it { expect(response).to have_http_status :service_unavailable } + it { expect(response.body).to include('planned maintenance') } + end + + context '/ping' do + before { get '/ping' } + it { expect(response).to be_ok } + it { expect(response.body).to be_json } + end + + context '/healthcheck' do + before do + allow(Sidekiq::ProcessSet).to receive(:new).and_return(instance_double(Sidekiq::ProcessSet, size: 1)) + allow(Sidekiq::RetrySet).to receive(:new).and_return(instance_double(Sidekiq::RetrySet, size: 0)) + allow(Sidekiq::DeadSet).to receive(:new).and_return(instance_double(Sidekiq::DeadSet, size: 0)) + allow(ActiveRecord::Base.connection).to receive(:active?).and_return(true) + connection = double('connection', info: {}) + allow(Sidekiq).to receive(:redis).and_yield(connection) + get '/healthcheck' + end + + it { expect(response).to be_ok } + it { expect(response.body).to be_json } + end + + context 'web page requests (html)' do + context 'sign in' do + before { get '/users/sign_in' } + it_behaves_like 'maintenance page' + end + + context 'caseworker' do + before do + sign_in(user) + end + + let(:user) { create(:case_worker).user } + context '/case_workers/claims' do + before { get case_workers_home_path } + it_behaves_like 'maintenance page' + end + end + + context 'advocate' do + before { sign_in user } + let(:user) { create(:external_user, :advocate).user } + + context '/external_user/claims' do + before { get external_users_claims_path } + it_behaves_like 'maintenance page' + end + + context '/advocates/claims/new' do + before { get new_advocates_claim_path } + it_behaves_like 'maintenance page' + end + end + end + + context 'api requests (json)' do + let(:user) { create(:external_user, :advocate).user } + + context '/api/case_types' do + before { get '/api/case_types', params: { api_key: user.persona.provider.api_key, format: :json } } + + it { expect(response).to have_http_status :service_unavailable } + it { expect(response.body).to be_json } + it { expect(response.body).to include_json({error: "Temporarily unavailable"}.to_json) } + end + end +end
Add request spec for servicedown note: must reset/reload routes in non-maintenance mode after each/all specs