diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/roles/bytemark.rb b/roles/bytemark.rb index abc1234..def5678 100644 --- a/roles/bytemark.rb +++ b/roles/bytemark.rb @@ -3,7 +3,7 @@ default_attributes( :networking => { - :nameservers => [ "[2001:41c8:2::2]", "[2001:41c8:2::1]", "80.68.80.25", "80.68.80.24" ], + :nameservers => [ "8.8.8.8", "8.8.4.4", "2001:4860:4860::8888", "2001:4860:4860::8844" ], :roles => { :external => { :zone => "bm"
BM: Switch to Google Public DNS until long replies reliable
diff --git a/app/models/guest_device.rb b/app/models/guest_device.rb index abc1234..def5678 100644 --- a/app/models/guest_device.rb +++ b/app/models/guest_device.rb @@ -20,4 +20,8 @@ def self.with_ethernet_type where(:device_type => "ethernet") end + + def self.with_storage_type + where(:device_type => "storage") + end end
Implement the with_storage_type named_scope for physical server
diff --git a/rails/pluralization/hu.rb b/rails/pluralization/hu.rb index abc1234..def5678 100644 --- a/rails/pluralization/hu.rb +++ b/rails/pluralization/hu.rb @@ -1,3 +1,3 @@-require 'rails_i18n/common_pluralizations/other' +require 'rails_i18n/common_pluralizations/one_other' ::RailsI18n::Pluralization::OneOther.with_locale(:hu)
Fix incorrect `require` added in 7838ad5. This didn't break tests, I imagine that's because the test suite was already importing `one_other` via some other file?
diff --git a/files/gitlab-cookbooks/gitlab/recipes/users.rb b/files/gitlab-cookbooks/gitlab/recipes/users.rb index abc1234..def5678 100644 --- a/files/gitlab-cookbooks/gitlab/recipes/users.rb +++ b/files/gitlab-cookbooks/gitlab/recipes/users.rb @@ -27,6 +27,7 @@ account "GitLab user and group" do username gitlab_username uid node['gitlab']['user']['uid'] + guid gitlab_group groupname gitlab_group gid node['gitlab']['user']['gid'] shell node['gitlab']['user']['shell']
Set correct gid for gitlab user.
diff --git a/Casks/appcode-eap.rb b/Casks/appcode-eap.rb index abc1234..def5678 100644 --- a/Casks/appcode-eap.rb +++ b/Casks/appcode-eap.rb @@ -1,6 +1,6 @@ cask :v1 => 'appcode-eap' do - version '141.2000.4' - sha256 '964a077f89c3317116aeb566d398c96754f3eb06474f3c7039974f38197123ac' + version '141.2263.29' + sha256 '3459783061f10aff6b7190196a8b8949215d817fbf3c9f3770e8aeb55c1018bf' url "https://download.jetbrains.com/objc/AppCode-#{version}.dmg" name 'AppCode'
Update AppCode EAP to build 141.2263.29 This commit updates the version and sha256 stanzas
diff --git a/Casks/appcode-eap.rb b/Casks/appcode-eap.rb index abc1234..def5678 100644 --- a/Casks/appcode-eap.rb +++ b/Casks/appcode-eap.rb @@ -1,8 +1,8 @@ cask :v1 => 'appcode-eap' do version '3.2.0' - sha256 '2dd8a0a9246067ae6e092b9934cbadac6730a74fe400c8929b09792a0c0cda83' + sha256 'fa78dc8e2a7430e7173cecec7b6e369f3d2cf442facd7ee0df46592788b00715' - url 'http://download.jetbrains.com/objc/AppCode-141.1399.2.dmg' + url 'http://download.jetbrains.com/objc/AppCode-141.1689.23.dmg' homepage 'http://confluence.jetbrains.com/display/OBJC/AppCode+EAP' license :commercial
Update AppCode EAP to latest build This commit updates the sha256 and url stanzas. The version of the app itself has not changed.
diff --git a/Casks/jira-client.rb b/Casks/jira-client.rb index abc1234..def5678 100644 --- a/Casks/jira-client.rb +++ b/Casks/jira-client.rb @@ -1,6 +1,6 @@ cask :v1 => 'jira-client' do - version '3.6.2' - sha256 '6add59e92511f6017fc8cc5d74e14ec78c31e3f8e29df7dc0b63acb5e1261fe6' + version '3.7.0' + sha256 'c4a4b45b260d59992c9e548618f6dfac1221a084d4564c81b5d2f0943d7b9739' url "http://d1.almworks.com/.files/jiraclient-#{version.gsub('.','_')}.dmg" name 'JIRA Client'
Upgrade JIRA Client to 3.7.0
diff --git a/app/decorators/user_decorator.rb b/app/decorators/user_decorator.rb index abc1234..def5678 100644 --- a/app/decorators/user_decorator.rb +++ b/app/decorators/user_decorator.rb @@ -8,7 +8,7 @@ def admin_link_with_popover(chapter=nil) common_opts = { data: { toggle: "popover", content: h.html_escape_once(popover_preview) }, title: name, class: "popoverable" } if chapter - h.link_to name, h.admin_chapter_user_path(chapter, object), data: common_opts + h.link_to name, h.admin_chapter_user_path(chapter, object), common_opts else h.link_to name, h.admin_user_path(object), common_opts end
Fix typo that stopped admin info popovers working on chapter/event pages in the eadmin interface.
diff --git a/Casks/iphone-configuration-utility.rb b/Casks/iphone-configuration-utility.rb index abc1234..def5678 100644 --- a/Casks/iphone-configuration-utility.rb +++ b/Casks/iphone-configuration-utility.rb @@ -4,4 +4,5 @@ version '3.5' sha256 '822204947ae5f7739bcb1e9694814f8e3ef65cd184952b76104f525d97a28163' install 'iPhoneConfigurationUtility.pkg' + uninstall :pkgutil => 'com.apple.pkg.iPhoneConfigurationUtility.*' end
Add uninstall stanza for iPhone Configuration Utility
diff --git a/spec/graph_spec.rb b/spec/graph_spec.rb index abc1234..def5678 100644 --- a/spec/graph_spec.rb +++ b/spec/graph_spec.rb @@ -10,6 +10,18 @@ graph1 = Graph::Graph.new('graph1') graph1.name.should eq('graph1') graph1.nodes.empty?.should eq(true) + end + + end + + describe 'add' do + + it "should add a node to the graph with the given value" do + graph1 = Graph::Graph.new('graph1') + graph1.nodes.empty?.should eq(true) + graph1.add(11) + graph1.nodes.empty?.should eq(false) + graph1.nodes[0].value.should eq(11) end end
Add a spec for an add method as part of the Graph class.
diff --git a/spec/features/clubs/list_spec.rb b/spec/features/clubs/list_spec.rb index abc1234..def5678 100644 --- a/spec/features/clubs/list_spec.rb +++ b/spec/features/clubs/list_spec.rb @@ -0,0 +1,15 @@+require 'spec_helper.rb' + +feature "Viewing a list of Clubs", js: true do + let(:club_list){FactoryGirl::create_list(:club, 10)} + + scenario "View all Clubs" do + club_list + visit "#/clubs" + + for club in club_list do + expect(page).to have_content(club.name) + expect(page).to have_content(club.city) + end + end +end
Add list feature spec for clubs
diff --git a/spec/pdfs/statements_pdf_spec.rb b/spec/pdfs/statements_pdf_spec.rb index abc1234..def5678 100644 --- a/spec/pdfs/statements_pdf_spec.rb +++ b/spec/pdfs/statements_pdf_spec.rb @@ -0,0 +1,21 @@+require "spec_helper" + +describe StatementsPdf do + + describe "#render" do + context "with one statement for a contributor with one contribution" do + it "renders a pdf with a nonzero size" do + contribution = create(:contribution, date: "2014-01-01") + contributor = contribution.contributor + + statement = Statement.new(contributor, "2014-01-01", "2014-12-31") + expect(statement.contributions.length).to eq 1 + + statements_pdf = StatementsPdf.new(statement) + rendered_statement = statements_pdf.render + expect(rendered_statement.size).to be > 0 + end + end + end + +end
Add basic spec to verify minimal statement pdf renders something This is just a sanity check to make sure something hasn't fundamentally broken in the rendering of a statement. It does not ensure that the pdf was correctly rendered, just that *something* was rendered.
diff --git a/spec/rspec/git_specifier_spec.rb b/spec/rspec/git_specifier_spec.rb index abc1234..def5678 100644 --- a/spec/rspec/git_specifier_spec.rb +++ b/spec/rspec/git_specifier_spec.rb @@ -21,9 +21,25 @@ it { is_expected.to all(match(/\A.*(?:\n\Z|\n\n)/)) } # force second line to be blank it { is_expected.to all(match(/\A.*[^.]\n/)) } # force first line to end with [^.] - # start with uppercase character or command - commands = %w(bundle rake rails guard sed) - it { is_expected.to all(match(/\A(?:[A-Z0-9]|#{commands.join('|')})/)) } + describe 'every lines' do + subject { super().map { |messages| messages.lines.map(&:strip) } } + + it 'should be 72 chars or fewer' do + expect(subject.map(&:size).max).to be <= 72 + end + + describe 'summary line' do + subject { super().map(&:first) } + + it 'should be 50 chars or fewer' do + expect(subject.map(&:size)).to all(be <= 50) + end + + # start with uppercase character or command + commands = %w(bundle rake rails guard sed) + it { is_expected.to all(match(/\A(?:[A-Z0-9]|#{commands.join('|')})/)) } + end + end end end
Add examples for testing commit message length
diff --git a/test/test_helper.rb b/test/test_helper.rb index abc1234..def5678 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -5,7 +5,7 @@ ENV['RAILS_ENV'] = 'test' # require File.expand_path("../dummy/config/environment.rb", __FILE__) -require File.expand_path('../rails421/config/environment.rb', __FILE__) +require File.expand_path('../rails610/config/environment.rb', __FILE__) require 'rails/test_help' Rails.backtrace_cleaner.remove_silencers!
Use the installed Rails 6.1 application for tests
diff --git a/spec/support/an_active_object.rb b/spec/support/an_active_object.rb index abc1234..def5678 100644 --- a/spec/support/an_active_object.rb +++ b/spec/support/an_active_object.rb @@ -4,6 +4,7 @@ let(:child_class) { Class.new(described_class) } subject { child_class.new } + before { child_class.send(:public, *child_class.protected_instance_methods) } it { should respond_to :semaphore } its(:semaphore) { should be_a Mutex } end
Make some protected methods available in testing
diff --git a/db/migrate/20151029212113_add_indices_and_uniqueness.rb b/db/migrate/20151029212113_add_indices_and_uniqueness.rb index abc1234..def5678 100644 --- a/db/migrate/20151029212113_add_indices_and_uniqueness.rb +++ b/db/migrate/20151029212113_add_indices_and_uniqueness.rb @@ -1,6 +1,5 @@ class AddIndicesAndUniqueness < ActiveRecord::Migration def change - add_index :users, :email, unique: true add_index :groups, :address, unique: true end end
Remove index from user table
diff --git a/spec/optioneer_spec.rb b/spec/optioneer_spec.rb index abc1234..def5678 100644 --- a/spec/optioneer_spec.rb +++ b/spec/optioneer_spec.rb @@ -6,7 +6,6 @@ end it 'should create an instance of the class with no errors' do - settings = Optioneer.new - expect(settings).to be_a Optioneer + expect(subject).to be_a Optioneer end end
Use rspec 'subject' instead of explicitly creating instance. Signed-off-by: Seapagan <4ab1b2fdb7784a8f9b55e81e3261617f44fd0585@gmail.com>
diff --git a/spec/colorls_spec.rb b/spec/colorls_spec.rb index abc1234..def5678 100644 --- a/spec/colorls_spec.rb +++ b/spec/colorls_spec.rb @@ -1,11 +1,29 @@ require 'spec_helper' RSpec.describe ColorLS do + FIXTURES = 'spec/fixtures'.freeze + it 'has a version number' do expect(ColorLS::VERSION).not_to be nil end it 'lists info of a hidden file with --long option' do - expect { ColorLS::Flags.new('--long', 'spec/fixtures/.hidden-file').process }.to_not output(/No Info/).to_stdout + expect { ColorLS::Flags.new('--long', "#{FIXTURES}/.hidden-file").process }.to_not output(/No Info/).to_stdout + end + + it 'does not list hidden files without --all option' do + expect { ColorLS::Flags.new(FIXTURES).process }.to_not output(/\.hidden-file/).to_stdout + end + + it 'lists hidden files with --all option' do + expect { ColorLS::Flags.new('--all', FIXTURES).process }.to output(/\.hidden-file/).to_stdout + end + + it 'does not show a report without --report option' do + expect { ColorLS::Flags.new(FIXTURES).process }.to_not output(/Found \d+ contents/).to_stdout + end + + it 'shows a report with --report option' do + expect { ColorLS::Flags.new('--report', FIXTURES).process }.to output(/Found \d+ contents/).to_stdout end end
Add specs for --all & --report flags
diff --git a/app/uploaders/avatar_uploader.rb b/app/uploaders/avatar_uploader.rb index abc1234..def5678 100644 --- a/app/uploaders/avatar_uploader.rb +++ b/app/uploaders/avatar_uploader.rb @@ -19,6 +19,10 @@ process resize_to_fill: [270, 260] end + version :v1_large do + process resize_to_fill: [370, 290] + end + # Add a white list of extensions which are allowed to be uploaded. # For images you might use something like this: def extension_whitelist
Add large avatar version for speaker
diff --git a/app/controllers/steps_controller.rb b/app/controllers/steps_controller.rb index abc1234..def5678 100644 --- a/app/controllers/steps_controller.rb +++ b/app/controllers/steps_controller.rb @@ -19,8 +19,6 @@ render :visitors elsif slots_step_needed? render :slots - elsif confirm_step_needed? - render :confirm end end
Remove unexercised branch for now We'll add it when we test it.
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index abc1234..def5678 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -39,12 +39,16 @@ def update @user = User.find_by(id: params[:id]) - if @user.update_attributes(username: user_params[:username], email: user_params[:email], password: user_params[:password]) - # flash[:success] = "Profile updated" - redirect_to "/" - else - @errors = @user.errors.full_messages - render 'users/edit' + if @user == current_user + if @user.update_attributes(username: user_params[:username], email: user_params[:email], password: user_params[:password]) + # flash[:success] = "Profile updated" + redirect_to "/" + else + @errors = @user.errors.full_messages + render 'users/edit' + end + else + redirect_to login_path end end
Add auth to POST '/users'
diff --git a/app/models/concerns/globalizable.rb b/app/models/concerns/globalizable.rb index abc1234..def5678 100644 --- a/app/models/concerns/globalizable.rb +++ b/app/models/concerns/globalizable.rb @@ -16,6 +16,10 @@ def description self.read_attribute(:description).try :html_safe end + + if self.paranoid? + translation_class.send :acts_as_paranoid, column: :hidden_at + end end class_methods do
Add paranoid behavior to translations of paranoid models We want to be able to fetch soft deleted translations without using with_deleted scope.
diff --git a/LAPickerView.podspec b/LAPickerView.podspec index abc1234..def5678 100644 --- a/LAPickerView.podspec +++ b/LAPickerView.podspec @@ -10,7 +10,7 @@ # s.screenshots = "www.example.com/screenshots_1", "www.example.com/screenshots_2" s.license = 'MIT' s.author = { "Luis Laugga" => "luis@laugga.com" } - s.source = { :git => "http://github.com/laugga/lapickerview.git", :tag => s.version.to_s } + s.source = { :git => "https://github.com/laugga/lapickerview.git", :tag => s.version.to_s } s.platform = :ios, '5.0' s.ios.deployment_target = '5.0'
Add https for git repository url.
diff --git a/lib/openc_bot/helpers/pseudo_machine_parser.rb b/lib/openc_bot/helpers/pseudo_machine_parser.rb index abc1234..def5678 100644 --- a/lib/openc_bot/helpers/pseudo_machine_parser.rb +++ b/lib/openc_bot/helpers/pseudo_machine_parser.rb @@ -14,21 +14,34 @@ def parse(fetched_datum) # implement in bot - # may return either a single parsed datum or an array of data from - # single fetched_datum, e.g. if fetched_datum is a CSV file + # may return either: + # a single parsed datum + # an array of data from single fetched_datum, e.g. if fetched_datum is a CSV file + # call "yield(parsed_datum)" inside the parse method passing each parsed record, to persist one-by-one end def run start_time = Time.now.utc counter = 0 input_data do |fetched_datum| - parsed_data = parse(fetched_datum) - parsed_data = [parsed_data] unless parsed_data.is_a?(Array) - parsed_data.each do |parsed_datum| + yielded = false + # the parse method can use yield + parsed_data = parse(fetched_datum) do |parsed_datum| + yielded = true next if parsed_datum.blank? persist(parsed_datum) counter += 1 + end + + unless yielded + parsed_data = [parsed_data] unless parsed_data.is_a?(Array) + parsed_data.each do |parsed_datum| + next if parsed_datum.blank? + + persist(parsed_datum) + counter += 1 + end end end { parsed: counter, parser_start: start_time, parser_end: Time.now.utc }
Allow external bots persisting parsed data record-by-record by yielding a block
diff --git a/lib/rails_soft_deletable/rails/associations.rb b/lib/rails_soft_deletable/rails/associations.rb index abc1234..def5678 100644 --- a/lib/rails_soft_deletable/rails/associations.rb +++ b/lib/rails_soft_deletable/rails/associations.rb @@ -9,7 +9,7 @@ return if options[:polymorphic] && klass.nil? if options[:with_deleted] && klass.soft_deletable? - klass.unscoped + klass.with_deleted else klass.scoped end
Use with_deleted instead of unscoped
diff --git a/K9LogPatternFormatter.podspec b/K9LogPatternFormatter.podspec index abc1234..def5678 100644 --- a/K9LogPatternFormatter.podspec +++ b/K9LogPatternFormatter.podspec @@ -19,6 +19,7 @@ spec.subspec 'Lumberjack' do |lumberjack| lumberjack.source_files = 'Classes/Lumberjack/**/*.{h,m}' + lumberjack.dependency 'K9LogPatternFormatter/Core' lumberjack.dependency 'CocoaLumberjack' end
Add common dependency in subspec
diff --git a/db/migrate/20190206235733_change_drug_id_to_bigint.rb b/db/migrate/20190206235733_change_drug_id_to_bigint.rb index abc1234..def5678 100644 --- a/db/migrate/20190206235733_change_drug_id_to_bigint.rb +++ b/db/migrate/20190206235733_change_drug_id_to_bigint.rb @@ -0,0 +1,9 @@+class ChangeDrugIdToBigint < ActiveRecord::Migration[6.0] + def up + change_column :drugs, :id, :bigint + end + + def down + change_column :drugs, :id, :integer + end +end
Update drug_id primary key to bigint
diff --git a/fastlane-plugin-trainer/lib/fastlane/plugin/trainer/actions/trainer_action.rb b/fastlane-plugin-trainer/lib/fastlane/plugin/trainer/actions/trainer_action.rb index abc1234..def5678 100644 --- a/fastlane-plugin-trainer/lib/fastlane/plugin/trainer/actions/trainer_action.rb +++ b/fastlane-plugin-trainer/lib/fastlane/plugin/trainer/actions/trainer_action.rb @@ -24,7 +24,7 @@ FastlaneCore::ConfigItem.new(key: :path, env_name: "trainer_PATH", description: "Path to the directory containing the plist files", - default_value: ".", + default_value: Actions.lane_context[Actions::SharedValues::SCAN_DERIVED_DATA_PATH] || ".", type: String) ] end
Use scan’s derived data by default
diff --git a/spec/cfer_spec.rb b/spec/cfer_spec.rb index abc1234..def5678 100644 --- a/spec/cfer_spec.rb +++ b/spec/cfer_spec.rb @@ -5,6 +5,11 @@ class B < Cfer::Resource def c(e) d e + end + + def post_block + super + i "j" end end end @@ -42,8 +47,12 @@ expect(h[:Resources][:R]).to have_key :D expect(h[:Resources][:R][:D]).to eq("e") + expect(h[:Resources][:R]).to have_key :I + expect(h[:Resources][:R][:I]).to eq("j") + expect(h[:Resources][:R]).to have_key :Properties expect(h[:Resources][:R][:Properties]).to have_key :Tags end + end
Test for post_block k/v pairs
diff --git a/spec/memo_spec.rb b/spec/memo_spec.rb index abc1234..def5678 100644 --- a/spec/memo_spec.rb +++ b/spec/memo_spec.rb @@ -2,14 +2,22 @@ describe 'memoized rules' do specify 'memoized symbol prefix' do - direction = Calyx::Grammar.new(123) do + grammar = Calyx::Grammar.new do rule :start, "Enter {character}. Exit {character}." rule :character, :@name rule :name, "Vladimir", "Estragon" end - 10.times do - expect(direction.generate).to eq("Enter Vladimir. Exit Vladimir.") + expect(grammar.generate).to eq(grammar.generate) + end + + specify 'memoized template expression' do + grammar = Calyx::Grammar.new do + rule :burger, "Monolith {@extras}" + rule :burger_combo, "Jumbo Monolith {@extras}" + rule :extras, "w/ extra grease", "w/ polycheese" end + + expect(grammar.generate(:burger_combo)).to include(grammar.generate(:burger)) end end
Add additional tests of memoized symbols in template strings
diff --git a/spec/path_spec.rb b/spec/path_spec.rb index abc1234..def5678 100644 --- a/spec/path_spec.rb +++ b/spec/path_spec.rb @@ -0,0 +1,67 @@+require 'spec_helper' + +RSpec.describe Path do + describe '.new' do + it 'constructs a cleansed path' do + path = described_class.new("./hoopty/doopty/doo\n") + expect(path).to eq('hoopty/doopty/doo') + end + end + + describe '#test_file?' do + context 'when path is to a test file' do + context 'when path is to a cucumber file' do + it 'returns true' do + path = described_class.new('features/aouaoeu/aoeuaoeua') + expect(path.test_file?).to eq(true) + end + end + + context 'when path is to a MiniTest or Test::Unit file' do + it 'returns true' do + path = described_class.new('test/aouaoeu/aoeuaoeua') + expect(path.test_file?).to eq(true) + end + end + + context 'when path is to a RSpec file' do + it 'returns true' do + path = described_class.new('spec/aouaoeu/aoeuaoeua') + expect(path.test_file?).to eq(true) + end + end + end + + context 'when path is not to a test file' do + it 'returns false' do + path = described_class.new('jackroot/aouaoeu/aoeuaoeua') + expect(path.test_file?).to eq(false) + end + end + end + + describe '#directory?' do + context 'when the path is to something on the file system' do + context 'when the path is to a directory on the file system' do + it 'returns true' do + path = described_class.new('resources') + expect(path.directory?).to eq(true) + end + end + + context 'when the path is not to a directory on the file system' do + it 'returns false' do + path = described_class.new('resources/demo.gif') + expect(path.directory?).to eq(false) + end + end + end + + context 'when the path is to something NOT on the file system' do + it 'returns false' do + path = described_class.new('jackroot/aouaoeu/aoeuaoeua') + expect(path.directory?).to eq(false) + end + end + end +end
Add test coverage for the Path class Why you made the change: I did this so that we would have some safety when evolving and refactoring this code base.
diff --git a/lib/thinking_sphinx/active_record/collection_proxy.rb b/lib/thinking_sphinx/active_record/collection_proxy.rb index abc1234..def5678 100644 --- a/lib/thinking_sphinx/active_record/collection_proxy.rb +++ b/lib/thinking_sphinx/active_record/collection_proxy.rb @@ -13,8 +13,11 @@ private def attribute_for_foreign_key - foreign_key = proxy_association.reflection.foreign_key - stack = [proxy_association.reflection.options[:through]].compact + if proxy_association.reflection.through_reflection + foreign_key = proxy_association.reflection.through_reflection.foreign_key + else + foreign_key = proxy_association.reflection.foreign_key + end proxy_association.klass.define_indexes (proxy_association.klass.sphinx_indexes || []).each do |index|
Handle through associations in model.association.search calls
diff --git a/sentry-ruby/sentry-ruby.gemspec b/sentry-ruby/sentry-ruby.gemspec index abc1234..def5678 100644 --- a/sentry-ruby/sentry-ruby.gemspec +++ b/sentry-ruby/sentry-ruby.gemspec @@ -23,5 +23,5 @@ spec.require_paths = ["lib"] spec.add_dependency "faraday", ">= 1.0" - spec.add_dependency "concurrent-ruby" + spec.add_dependency "concurrent-ruby", '~> 1.0', '>= 1.0.2' end
Add clearer requirement on concurrent-ruby
diff --git a/spec/controllers/statistics_controller_spec.rb b/spec/controllers/statistics_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/statistics_controller_spec.rb +++ b/spec/controllers/statistics_controller_spec.rb @@ -0,0 +1,34 @@+require 'rails_helper' + +describe StatisticsController do + let(:user) { FactoryBot.create(:admin) } + before(:each) { allow(controller).to receive(:current_user).and_return(user) } + + [:show, :graphs].each do |route| + describe "GET ##{route}" do + before(:each) { get route } + + expect_status(200) + expect_template(route) + end + end + + [:user_activity_history, :rfc_activity_history].each do |route| + describe "GET ##{route}" do + before(:each) { get route } + + expect_status(200) + expect_template(:activity_history) + end + end + + [:show, :user_activity, :user_activity_history, :rfc_activity, :rfc_activity_history].each do |route| + describe "GET ##{route}.json" do + before(:each) { get route, format: :json } + + expect_status(200) + expect_json + end + end + +end
Add tests for statistics controller routes
diff --git a/lib/generators/public_activity/migration/templates/migration.rb b/lib/generators/public_activity/migration/templates/migration.rb index abc1234..def5678 100644 --- a/lib/generators/public_activity/migration/templates/migration.rb +++ b/lib/generators/public_activity/migration/templates/migration.rb @@ -9,7 +9,7 @@ t.text :parameters t.belongs_to :recipient, :polymorphic => true - t.timestamps + t.timestamps null: false end add_index :activities, [:trackable_id, :trackable_type]
Remove deprecation warning during migrate about timestamps This warning occurs when you tried to rake:db migrate in a rails 4.2 application. It's a deprecation warning for upcoming rails 5, a null option need to be given : DEPRECATION WARNING: `#timestamp` was called without specifying an option for `null`. In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to prevent the behavior of your existing migrations from changing. (called from block in up at db/migrate/20151104181305_create_activities.rb:12)
diff --git a/ruby/open-location-code.gemspec b/ruby/open-location-code.gemspec index abc1234..def5678 100644 --- a/ruby/open-location-code.gemspec +++ b/ruby/open-location-code.gemspec @@ -5,7 +5,7 @@ Gem::Specification.new do |s| s.name = "open-location-code" - s.version = "1.0.2" + s.version = "1.0.3" s.authors = ["Wei-Ming Wu"] s.date = Date.today.to_s s.email = ["wnameless@gmail.com"]
Bump Ruby version to 1.0.3.
diff --git a/rails_event_store/lib/rails_event_store/repositories/event_repository.rb b/rails_event_store/lib/rails_event_store/repositories/event_repository.rb index abc1234..def5678 100644 --- a/rails_event_store/lib/rails_event_store/repositories/event_repository.rb +++ b/rails_event_store/lib/rails_event_store/repositories/event_repository.rb @@ -23,7 +23,7 @@ end def get_all_events - adapter.find(:all, order: 'stream').map &method(:build_event_entity) + adapter.order('id ASC').order('stream').all.map &method(:build_event_entity) end def last_stream_event(stream_name)
Use supported Rails methods for finding all events
diff --git a/spec/features/home_page_spec.rb b/spec/features/home_page_spec.rb index abc1234..def5678 100644 --- a/spec/features/home_page_spec.rb +++ b/spec/features/home_page_spec.rb @@ -1,3 +1,5 @@+require 'rails_helper' + RSpec.feature 'Home page' do scenario 'visit the home page' do visit root_path
Include 'rails_helper' in home page spec
diff --git a/schema.gemspec b/schema.gemspec index abc1234..def5678 100644 --- a/schema.gemspec +++ b/schema.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |s| s.name = 'evt-schema' s.summary = "Primitives for schema and data structure" - s.version = '2.3.1.2' + s.version = '2.3.1.1' s.description = ' ' s.authors = ['The Eventide Project']
Package version is increased from 2.3.1.2 to 2.3.1.1
diff --git a/smappy.gemspec b/smappy.gemspec index abc1234..def5678 100644 --- a/smappy.gemspec +++ b/smappy.gemspec @@ -11,7 +11,7 @@ s.email = "tomeric@eet.nu" s.homepage = "http://github.com/eet-nu/smappy" - s.files = Dir["{lib}/**/*"] + ["LICENSE", "Rakefile", "Gemfile", "README.md"] + s.files = Dir["{lib,markers,spec}/**/*"] + ["LICENSE", "Rakefile", "Gemfile", "README.md"] s.add_dependency "rmagick" end
Add markers/ and spec/ files to gemspec
diff --git a/activerecord/lib/active_record/encryption/extended_deterministic_uniqueness_validator.rb b/activerecord/lib/active_record/encryption/extended_deterministic_uniqueness_validator.rb index abc1234..def5678 100644 --- a/activerecord/lib/active_record/encryption/extended_deterministic_uniqueness_validator.rb +++ b/activerecord/lib/active_record/encryption/extended_deterministic_uniqueness_validator.rb @@ -12,8 +12,8 @@ super(record, attribute, value) klass = record.class - klass.deterministic_encrypted_attributes&.each do |attribute_name| - encrypted_type = klass.type_for_attribute(attribute_name) + if klass.deterministic_encrypted_attributes&.include?(attribute) + encrypted_type = klass.type_for_attribute(attribute) [ encrypted_type, *encrypted_type.previous_types ].each do |type| encrypted_value = type.serialize(value) ActiveRecord::Encryption.without_encryption do
Remove N+1 validation for encrypted attributes
diff --git a/spec/unit/data_mapper/mapper/class_methods/from_spec.rb b/spec/unit/data_mapper/mapper/class_methods/from_spec.rb index abc1234..def5678 100644 --- a/spec/unit/data_mapper/mapper/class_methods/from_spec.rb +++ b/spec/unit/data_mapper/mapper/class_methods/from_spec.rb @@ -4,17 +4,15 @@ subject { described_class.from(other, name) } let(:model) { - mock_model(:TestModel) + mock_model('TestModel') } let(:other) { - model_class = model - address_model = mock_model('Address') - - Class.new(described_class) { - model model_class + klass = Class.new(described_class) { map :id, Integer } + klass.model(model) + klass } context "with another mapper" do @@ -30,6 +28,10 @@ its(:model) { should be(model) } its(:name) { should eql(name) } + + it "copies attributes" do + subject.attributes[:id].should be_instance_of(Mapper::Attribute::Primitive) + end end end end
Clean up spec for Mapper.from
diff --git a/plugins/graphite/graphite.rb b/plugins/graphite/graphite.rb index abc1234..def5678 100644 --- a/plugins/graphite/graphite.rb +++ b/plugins/graphite/graphite.rb @@ -3,9 +3,9 @@ hostname = `hostname -s`.chomp! -host = config[:host] || 'localhost' -port = config[:port] || '2003' -path = config[:path] || hostname +host = config[:host] || 'localhost' +port = config[:port] || '2003' +prefix = config[:prefix] || hostname socket = TCPSocket.open(host, port) @@ -23,7 +23,7 @@ # Replace pan's default "|" delim with "." so Graphite groups properly. metric.gsub!(/\|/, '.') - stat = "#{path}.#{metric} #{metrics[k]} #{t}" + stat = "#{prefix}.#{metric} #{metrics[k]} #{t}" socket.write("#{stat}\n") } }
Rename path variable to prefix.
diff --git a/UIViewAppearanceSwift.podspec b/UIViewAppearanceSwift.podspec index abc1234..def5678 100644 --- a/UIViewAppearanceSwift.podspec +++ b/UIViewAppearanceSwift.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.module_name = 'UIViewAppearanceSwift' - s.name = 'UICommon' + s.name = 'UIViewAppearanceSwift' s.version = '0.0.1' s.license = 'MIT' s.summary = 'Common UIViewAppearanceSwift @levantAJ team'
Update date name of spec
diff --git a/lib/active_touch/touch_job.rb b/lib/active_touch/touch_job.rb index abc1234..def5678 100644 --- a/lib/active_touch/touch_job.rb +++ b/lib/active_touch/touch_job.rb @@ -13,10 +13,8 @@ associated.send(after_touch) unless after_touch.blank? elsif !associated.nil? - associated.each do |associate| - associate.update_columns(updated_at: record.updated_at) - associate.send(after_touch) unless after_touch.blank? - end + associated.update_all(updated_at: record.updated_at) + associated.each { |associate| associate.send(after_touch) } unless after_touch.blank? end end
Revert the individual touches for grouped associations.
diff --git a/lib/cortex/snippets/client.rb b/lib/cortex/snippets/client.rb index abc1234..def5678 100644 --- a/lib/cortex/snippets/client.rb +++ b/lib/cortex/snippets/client.rb @@ -23,7 +23,7 @@ if defined?(Rails) url = sanitized_webpage_url(request.original_url) Rails.cache.fetch("webpages/#{@cortex_client.access_token.client.id}/#{url}", race_condition_ttl: 10) do - Cortex::Snippets::Client::Webpage.new(@cortex_client, url) + Cortex::Snippets::Webpage.new(@cortex_client, url) end else raise 'Your Web framework is not supported. Supported frameworks: Rails'
Fix reference to Webpage class
diff --git a/lib/graphql/interface_type.rb b/lib/graphql/interface_type.rb index abc1234..def5678 100644 --- a/lib/graphql/interface_type.rb +++ b/lib/graphql/interface_type.rb @@ -23,7 +23,7 @@ # class InterfaceType < GraphQL::BaseType include GraphQL::BaseType::HasPossibleTypes - accepts_definitions :resolve_type, field: GraphQL::Define::AssignObjectField + accepts_definitions :resolve_type, :fields, field: GraphQL::Define::AssignObjectField lazy_defined_attr_accessor :fields
Allow Interface.define to accept fields
diff --git a/lib/rohbau/it_behaves_like.rb b/lib/rohbau/it_behaves_like.rb index abc1234..def5678 100644 --- a/lib/rohbau/it_behaves_like.rb +++ b/lib/rohbau/it_behaves_like.rb @@ -1,4 +1,4 @@-require 'minitest' +require 'minitest/spec' module Rohbau module ItBehavesLike
Change minitest require into minitest/spec
diff --git a/lib/saasable/saas_document.rb b/lib/saasable/saas_document.rb index abc1234..def5678 100644 --- a/lib/saasable/saas_document.rb +++ b/lib/saasable/saas_document.rb @@ -2,8 +2,8 @@ @saas_document = nil def self.included klass - if @saas_document and @saas_document != klass - raise Saasable::Errors::MultipleSaasDocuments, "you can only have one Saasable::SaasDocument" + if @saas_document and @saas_document.name != klass.name + raise Saasable::Errors::MultipleSaasDocuments, "you can only have one Saasable::SaasDocument" else @saas_document = klass end
Fix the bug with the Saasable::SaasDocument reloading with a different address.
diff --git a/lib/tasks/populate_image.rake b/lib/tasks/populate_image.rake index abc1234..def5678 100644 --- a/lib/tasks/populate_image.rake +++ b/lib/tasks/populate_image.rake @@ -0,0 +1,47 @@+$image_types = ['ccam_images', 'fcam_images', 'rcam_images', 'ncam_images', 'mastcam_left_images', 'mastcam_right_images', 'mahli_images', 'mardi_images'] + + +def get_images_for_sol(sol_url) + image_urls = [] + ret = RestClient.get sol_url + json_data = JSON.parse(ret) + $image_types.each do |type| + next unless json_data[type] + + image_groups = json_data[type] + image_groups.each do |group| + group['images'].each do |image| + image_urls << image['url'] + puts image_urls + next if Image.where(url: image['url']).exists? + + # skip images that are smaller than desired + next if image['dimensions'].nil? or image['dimensions']['area'].nil? + next if image['dimensions']['area'].any?{|dim| dim < 1000} + + begin + Image.create(url: image['url'], sol: json_data['sol'].to_i, camera_type: image['instrument'], image_time: DateTime.strptime(image['time']['creation_timestamp_utc'], '%Y-%m-%dT%H:%M:%S')) + rescue => e + puts "Failed to populate data for #{image['url']} because #{e.inspect} #{image['time']['creation_timestamp_utc']}" + end + end + end + end + return image_urls +end + +namespace :populate_image do + desc "Fetch MSL images" + task get_msl_images: :environment do + main_url = 'https://msl-raws.s3.amazonaws.com/images/image_manifest.json' + ret = RestClient.get main_url + json_data = JSON.parse(ret) + sols_data = json_data['sols'] + + images = [] + sols_data.each do |sol_data| + sol_image_urls = get_images_for_sol sol_data['url'] + images.concat(sol_image_urls) + end + end +end
Use rake task to fetch images instead of db seed script
diff --git a/guard-annotate.gemspec b/guard-annotate.gemspec index abc1234..def5678 100644 --- a/guard-annotate.gemspec +++ b/guard-annotate.gemspec @@ -13,6 +13,11 @@ s.description = %q{Guard::Annotate automatically runs the annotate gem when needed} s.license = "MIT" + s.post_install_message = %Q(** guard-annotate is looking for maintainers. While I am still trying + to accept and stay on top of new Pull Requests, I no longer personally actively use this guard + plugin. If you are interested in becoming a maintainer please contact me via GitHub Issues at + https://github.com/guard/guard-annotate. **) + s.rubyforge_project = "guard-annotate" s.add_dependency 'guard-compat', '~> 1.2.1'
Add post install message to gemspec
diff --git a/spec/integration/snmpjr_spec.rb b/spec/integration/snmpjr_spec.rb index abc1234..def5678 100644 --- a/spec/integration/snmpjr_spec.rb +++ b/spec/integration/snmpjr_spec.rb @@ -0,0 +1,9 @@+describe "snmpjr" do + + describe 'GET' do + it "can perform a simple synchronous get request on an snmp agent" do + snmp = Snmpjr.new(:host => 'demo.snmplabs.com', :port => 161, :community => 'public') + expect(snmp.get '1.3.6.1.2.1.1.1.0').to eq 'SunOS zeus.snmplabs.com 4.1.3_U1 1 sun4m' + end + end +end
Add simple get integration spec
diff --git a/app/controllers/answers_controller.rb b/app/controllers/answers_controller.rb index abc1234..def5678 100644 --- a/app/controllers/answers_controller.rb +++ b/app/controllers/answers_controller.rb @@ -1,23 +1,29 @@ class AnswersController < ApplicationController def create + question = Question.find(question_id: params[:question_id]) + @answer = Answer.new(answer_params) + if @answer && @answer.save + else + flash[:alert] = "#{@answer.errors.full_messages.join("--")}" + end + redirect_to question end - def show + + private + + def answer_params + params.require(:answer).permit(:body, :user_id, :question_id) end - def edit - - end - - def update - - end - - def destroy - + def verify_answer_ownership + unless @answer.user_id == current_user.id + flash[:notice] = "This answer does not belong to you." + redirect_to root_path + end end end
Add create action for answers
diff --git a/app/models/salary_booking_template.rb b/app/models/salary_booking_template.rb index abc1234..def5678 100644 --- a/app/models/salary_booking_template.rb +++ b/app/models/salary_booking_template.rb @@ -1,6 +1,4 @@ class SalaryBookingTemplate < BookingTemplate - default_scope order(:code) - # Obligation flags def self.saldo_inclusion_flags ['gross_income', 'ahv', 'uvg', 'uvgz', 'ktg', 'deduction_at_source']
Move default order to BookingTemplate.
diff --git a/spec/models/event_spec.rb b/spec/models/event_spec.rb index abc1234..def5678 100644 --- a/spec/models/event_spec.rb +++ b/spec/models/event_spec.rb @@ -1,5 +1,14 @@ require 'rails_helper' RSpec.describe Event, type: :model do - pending "add some examples to (or delete) #{__FILE__}" + + it { is_expected.to validate_presence_of(:category)} + it { is_expected.to validate_presence_of(:volunteers_needed)} + it { is_expected.to validate_presence_of(:starts_at)} + it { is_expected.to validate_presence_of(:ends_at)} + it { is_expected.to validate_presence_of(:shift_length)} + it { is_expected.to validate_presence_of(:address)} + + it { is_expected.to define_enum_for(:category).with([:volunteer, :medical, :legal])} + end
Add validation and enum specs for event objects
diff --git a/spec/mumukit/user_spec.rb b/spec/mumukit/user_spec.rb index abc1234..def5678 100644 --- a/spec/mumukit/user_spec.rb +++ b/spec/mumukit/user_spec.rb @@ -0,0 +1,15 @@+require 'spec_helper' + +describe Mumukit::Auth::User do + describe 'build_metadata' do + let(:user) { { bibliotheca: 'foo/bar', classroom: 'foo/baz' }.stringify_keys } + let(:auth0) { double('auth0') } + + before { expect(Auth0Client).to receive(:new) { auth0 }} + before { expect(auth0).to receive(:update_user_metadata).with('auth0|1', user.merge(atheneum: 'test/*')) } + before { expect(Mumukit::Auth::User).to receive(:get_user).with('auth0|1').and_return(user) } + + it { expect { Mumukit::Auth::User.update_metadata('auth0|1', atheneum: 'test/*') }.not_to raise_error } + end + +end
Add tests for user logic
diff --git a/rubiniusvm/compiler/compiler.rb b/rubiniusvm/compiler/compiler.rb index abc1234..def5678 100644 --- a/rubiniusvm/compiler/compiler.rb +++ b/rubiniusvm/compiler/compiler.rb @@ -15,7 +15,10 @@ end parser.input file, line + parser.print + printer = compiler.packager.print + printer.bytecode = true writer = compiler.writer writer.name = output ? output : compiled_name(file)
Print generated bytecode, useful for compaing what we produce and what actually generates rbx
diff --git a/fassets-presentations.gemspec b/fassets-presentations.gemspec index abc1234..def5678 100644 --- a/fassets-presentations.gemspec +++ b/fassets-presentations.gemspec @@ -7,8 +7,8 @@ Gem::Specification.new do |s| s.name = "fassets-presentations" s.version = FassetsPresentations::VERSION - s.authors = ["TODO: Your name"] - s.email = ["TODO: Your email"] + s.authors = ["Christopher Sharp, Julian Bäume"] + s.email = ["cdsharp@gmail.com, julian@svg4all.de"] s.homepage = "TODO" s.summary = "TODO: Summary of FassetsPresentations." s.description = "TODO: Description of FassetsPresentations."
Add our names and email adresses to the gemspec-file.
diff --git a/lib/cli/modular_options.rb b/lib/cli/modular_options.rb index abc1234..def5678 100644 --- a/lib/cli/modular_options.rb +++ b/lib/cli/modular_options.rb @@ -1,8 +1,10 @@ require 'optparse' + module CLI module WithOptions def cli_options( &block ) + raise ArgumentError, 'Block required but not given' unless block_given? const_set :CLI_OPTS_HOOKS, Array.new unless const_defined? :CLI_OPTS_HOOKS, false const_get(:CLI_OPTS_HOOKS) << block end
Verify block is given when adding hook
diff --git a/lib/feed2email/core_ext.rb b/lib/feed2email/core_ext.rb index abc1234..def5678 100644 --- a/lib/feed2email/core_ext.rb +++ b/lib/feed2email/core_ext.rb @@ -24,7 +24,7 @@ end def numeric? - !!(self =~ /\A\d+\z/) + !(self =~ /\A\d+\z/).nil? end def pluralize(count, plural = self + 's')
Replace !! with explicit check for nil
diff --git a/lib/gitlab/git/rev_list.rb b/lib/gitlab/git/rev_list.rb index abc1234..def5678 100644 --- a/lib/gitlab/git/rev_list.rb +++ b/lib/gitlab/git/rev_list.rb @@ -31,7 +31,7 @@ output, status = popen(args, nil, Gitlab::Git::Env.all.stringify_keys) unless status.zero? - raise "Got a non-zero exit code while calling out `#{args.join(' ')}`." + raise "Got a non-zero exit code while calling out `#{args.join(' ')}`: #{output}" end output.split("\n")
Include RevList error messages in exceptions
diff --git a/lib/srtshifter/subtitle.rb b/lib/srtshifter/subtitle.rb index abc1234..def5678 100644 --- a/lib/srtshifter/subtitle.rb +++ b/lib/srtshifter/subtitle.rb @@ -8,6 +8,8 @@ end def shift + + start_time = Time.now output_file = File.open(@opts[:output], 'w') @@ -28,7 +30,10 @@ end end - puts "Success!" + end_time = Time.now + + puts "File created with success!" + puts "Elapsed time: #{end_time-start_time} seconds." end def convert_time time
Change success message. Add 'elapsed time' stdout
diff --git a/app/models/user.rb b/app/models/user.rb index abc1234..def5678 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,27 +1,37 @@ class User < ActiveRecord::Base - - before_save { self.email = email.downcase } before_create :create_remember_token attr_accessor :twitter_id, :facebook, :linkedin, :location validates :name, presence: true, length: { maximum: 50 } VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i - validates :email, presence: true, format: { with: VALID_EMAIL_REGEX }, uniqueness: { case_sensitive: false } - has_secure_password - validates :password, length: { minimum: 6 }, :unless => lambda{ |user| user.password.blank? } - - def User.new_remember_token - SecureRandom.urlsafe_base64 - end - - def User.encrypt(token) - Digest::SHA1.hexdigest(token.to_s) - end - - private - - def create_remember_token - self.remember_token = User.encrypt(User.new_remember_token) - end + validates :email, presence: true, format: { with: VALID_EMAIL_REGEX }, uniqueness: { case_sensitive: false } + has_secure_password + validates :password, length: { minimum: 6 }, :unless => lambda{ |user| user.password.blank? } + + # Convert user's name to friently url format + def slug + name.downcase.gsub(" ", "-") + end + + # Change default param for user from id to id-name for friendly urls. + # When finding in DB, Rails auto calls .to_i on param, which tosses + # name and doesn't cause any problems in locating user. + def to_param + "#{id}-#{slug}" + end + + def User.new_remember_token + SecureRandom.urlsafe_base64 + end + + def User.encrypt(token) + Digest::SHA1.hexdigest(token.to_s) + end + + + private + def create_remember_token + self.remember_token = User.encrypt(User.new_remember_token) + end end
Make Users use friendly url params
diff --git a/fixture_dependencies.gemspec b/fixture_dependencies.gemspec index abc1234..def5678 100644 --- a/fixture_dependencies.gemspec +++ b/fixture_dependencies.gemspec @@ -1,11 +1,11 @@ Gem::Specification.new do |s| s.name = "fixture_dependencies" - s.version = "1.7.0" + s.version = "1.7.1" s.author = "Jeremy Evans" s.email = "code@jeremyevans.net" s.platform = Gem::Platform::RUBY s.summary = "Sequel/ActiveRecord fixture loader that handles dependency graphs" - s.files = ["README.md", "MIT-LICENSE", "lib/fixture_dependencies.rb", "lib/fixture_dependencies_test_help.rb", "lib/fixture_dependencies/sequel.rb", "lib/fixture_dependencies/active_record.rb", "lib/fixture_dependencies/test_unit.rb", "lib/fixture_dependencies/test_unit/rails.rb", "lib/fixture_dependencies/test_unit/sequel.rb", "lib/fixture_dependencies/rspec/sequel.rb"] + s.files = ["README.md", "MIT-LICENSE", "lib/fixture_dependencies.rb", "lib/fixture_dependencies_test_help.rb", "lib/fixture_dependencies/sequel.rb", "lib/fixture_dependencies/active_record.rb", "lib/fixture_dependencies/minitest_spec.rb", "lib/fixture_dependencies/minitest_spec/sequel.rb", "lib/fixture_dependencies/test_unit.rb", "lib/fixture_dependencies/test_unit/rails.rb", "lib/fixture_dependencies/test_unit/sequel.rb", "lib/fixture_dependencies/rspec/sequel.rb"] s.extra_rdoc_files = ["MIT-LICENSE"] s.require_paths = ["lib"] s.has_rdoc = true
Add the minitest support files to the gemspec The gem does not include the two files added for 1.7.0 with minitest_spec support. This change remedies that. % diff -u \ <(gem contents fixture_dependencies -v 1.7.0 --no-prefix) \ <(gem contents fixture_dependencies -v 1.7.1 --no-prefix) ```diff --- /dev/fd/11 2016-04-22 13:26:04.000000000 -0400 +++ /dev/fd/12 2016-04-22 13:26:04.000000000 -0400 @@ -2,6 +2,8 @@ README.md lib/fixture_dependencies.rb lib/fixture_dependencies/active_record.rb +lib/fixture_dependencies/minitest_spec.rb +lib/fixture_dependencies/minitest_spec/sequel.rb lib/fixture_dependencies/rspec/sequel.rb lib/fixture_dependencies/sequel.rb lib/fixture_dependencies/test_unit.rb ```
diff --git a/spec/support/redirect_server.rb b/spec/support/redirect_server.rb index abc1234..def5678 100644 --- a/spec/support/redirect_server.rb +++ b/spec/support/redirect_server.rb @@ -9,13 +9,13 @@ end def self.address - 'http://127.0.0.1:8201/' + 'http://127.0.0.1:8202/' end def self.start @server ||= begin server = WEBrick::HTTPServer.new( - Port: 8201, + Port: 8202, Logger: WEBrick::Log.new("/dev/null"), AccessLogs: [], )
Change redirect port to avoid Vault's cluster default.
diff --git a/money-historical-bank.gemspec b/money-historical-bank.gemspec index abc1234..def5678 100644 --- a/money-historical-bank.gemspec +++ b/money-historical-bank.gemspec @@ -7,13 +7,14 @@ s.email = ["wam@atwam.com", "jon.allured@gmail.com"] s.description = "A gem that provides rates for the money gem. Able to handle history (rates varying in time), and auto download rates from open-exchange-rates. Highly inspired by money-open-exchange-rates gem." s.summary = "A gem that offers exchange rates varying in time." - s.extra_rdoc_files = %w(README.markdown) - s.files = Dir["LICENSE", "README.markdown", "Gemfile", "lib/**/*.rb", 'test/**/*'] + s.extra_rdoc_files = %w(README.md) + s.files = Dir["LICENSE", "README.md", "Gemfile", "lib/**/*.rb", 'test/**/*'] s.test_files = Dir.glob("test/*_test.rb") s.require_paths = ["lib"] s.rubygems_version = %q{1.3.7} - s.add_dependency "yajl-ruby", ">=0.8.3" - s.add_dependency "money", ">=3.7.1" - s.add_development_dependency "minitest", ">=2.0" - s.add_development_dependency "rr", ">=1.0.4" + s.license = "MIT" + s.add_dependency "yajl-ruby", "~>0.8", ">=0.8.3" + s.add_dependency "money", "~>3.7", ">=3.7.1" + s.add_development_dependency "minitest", "~>2.0", ">=2.0" + s.add_development_dependency "rr", "~>1.0", ">=1.0.4" end
Fix gemspec, adding license and semantic dependencies
diff --git a/app/models/domain.rb b/app/models/domain.rb index abc1234..def5678 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -2,4 +2,8 @@ has_many :domain_admin_roles has_many :admins, :through => :domain_admin_roles, :source => :user has_many :org_units + + def imported? + imported_at.present? + end end
Add convenience method for :imported?
diff --git a/app/models/lesson.rb b/app/models/lesson.rb index abc1234..def5678 100644 --- a/app/models/lesson.rb +++ b/app/models/lesson.rb @@ -1,5 +1,5 @@ class Lesson < ActiveRecord::Base - attr_accessible :background, :free, :title + attr_accessible :background, :free, :title, :video validates :title, :presence => { :message => "for lesson can't be blank" } validates :background, :presence => { :message => "for lesson can't be blank" }
Add video as attr_accessible for Lesson Update the Lesson model to make the video attribute as attr_accessible.
diff --git a/app/views/lotteries/_results.csv.ruby b/app/views/lotteries/_results.csv.ruby index abc1234..def5678 100644 --- a/app/views/lotteries/_results.csv.ruby +++ b/app/views/lotteries/_results.csv.ruby @@ -4,7 +4,7 @@ ::CSV.generate do |csv| csv << ["Results for #{lottery.name}"] - lottery.divisions.each do |division| + lottery.divisions.ordered_by_name.each do |division| csv << ["\n"] csv << [division.name] csv << ["Accepted"]
Order divisions by name for lottery results export
diff --git a/test/unit/jekyll_payload_test.rb b/test/unit/jekyll_payload_test.rb index abc1234..def5678 100644 --- a/test/unit/jekyll_payload_test.rb +++ b/test/unit/jekyll_payload_test.rb @@ -0,0 +1,63 @@+require 'support/test_case' +require 'support/fixture_config' +require 'jekyll/minibundle/development_file_collection' +require 'jekyll/minibundle/bundle_file' +require 'jekyll/minibundle/stamp_file' + +module Jekyll::Minibundle::Test + class JekyllPayloadTest < TestCase + include FixtureConfig + + def test_sorts_stamp_files_in_site_payload + with_site do |site| + file = StampFile.new(site, STAMP_SOURCE_PATH, STAMP_DESTINATION_PATH, &stamp_basenamer) + run_site_payload(site, file) + end + end + + def test_sorts_bundle_files_in_site_payload + with_site do |site| + file = BundleFile.new(site, bundle_config) + run_site_payload(site, file) + end + end + + def test_sorts_development_files_in_site_payload + with_site do |site| + file = DevelopmentFileCollection.new(site, bundle_config) + run_site_payload(site, file) + end + end + + private + + def with_site(&block) + with_site_dir do + yield new_real_site + end + end + + def run_site_payload(site, file) + file.add_as_static_file_to(site) + + static_file = Jekyll::StaticFile.new(site, '.', 'dir', 'name.css') + site.static_files << static_file + + site.site_payload + end + + def stamp_basenamer + ->(base, ext, stamper) { "#{base}-#{stamper.call}#{ext}" } + end + + def bundle_config + { + 'type' => :js, + 'source_dir' => JS_BUNDLE_SOURCE_DIR, + 'assets' => %w{dependency app}, + 'destination_path' => JS_BUNDLE_DESTINATION_PATH, + 'attributes' => {} + } + end + end +end
Test our files can be sorted with Jekyll's static files
diff --git a/aws-sdk-core/lib/aws-sdk-core/json.rb b/aws-sdk-core/lib/aws-sdk-core/json.rb index abc1234..def5678 100644 --- a/aws-sdk-core/lib/aws-sdk-core/json.rb +++ b/aws-sdk-core/lib/aws-sdk-core/json.rb @@ -33,20 +33,20 @@ end def dump(value) - ENGINE.dump(value, ENGINE_DUMP_OPTIONS) + ENGINE.dump(value, *ENGINE_DUMP_OPTIONS) end private def oj_engine require 'oj' - [Oj, { mode: :compat }, Oj::ParseError] + [Oj, [{ mode: :compat }], Oj::ParseError] rescue LoadError false end def json_engine - [JSON, {}, JSON::ParserError] + [JSON, [], JSON::ParserError] end end
Fix for broken JSON.dump call.
diff --git a/benchmark/event.rb b/benchmark/event.rb index abc1234..def5678 100644 --- a/benchmark/event.rb +++ b/benchmark/event.rb @@ -0,0 +1,36 @@+$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) +require 'benchmark' +require 'analytics' +require 'thwait' + +raise "No Analytics Key Provided" unless ENV['GA_TRACKING_ID'] + +# configure analytics +Analytics.configure ENV['GA_TRACKING_ID'], "BenchmarkTest" + +reps = [1, 10, 100, 1000] + +Benchmark.bm do |bm| + + puts "Main Thread Time" + + reps.each do |count| + threads = [] + bm.report("#{count}x\t:") do + count.times{ threads << Analytics.event( category: "benchmarking", label: "event logging - main thread")} + end + ThreadsWait.all_waits(*threads) + sleep 5 + end + + puts "Total Time" + + reps.each do |count| + bm.report("#{count}x\t:") do + threads = [] + count.times{ threads << Analytics.event( category: "benchmarking", label: "event logging - all threads" )} + ThreadsWait.all_waits(*threads) + end + sleep 5 + end +end
Add trivial benchmarks to gauge cost of logging
diff --git a/spec/nymphia/dsl/context/host_context_methods_spec.rb b/spec/nymphia/dsl/context/host_context_methods_spec.rb index abc1234..def5678 100644 --- a/spec/nymphia/dsl/context/host_context_methods_spec.rb +++ b/spec/nymphia/dsl/context/host_context_methods_spec.rb @@ -0,0 +1,35 @@+require 'spec_helper' + +describe Nymphia::DSL::Context::HostContextMethods do + class Anonymous + include Nymphia::DSL::Context::HostContextMethods + + def initialize + @result = { + contents: {}, + } + + @context = { + identity_files: { + 'private' => '~/.ssh/private.pem', + 'company' => '~/.ssh/company.pem', + }, + } + end + end + + subject(:object) { Anonymous.new } + + describe '#use_identify_file' do + it 'contains file path for key file' do + result = { + contents: { + 'IdentityFile' => ['~/.ssh/company.pem'], + }, + } + + object.send(:use_identify_file, :company) + expect(object.instance_variable_get(:@result)).to eq result + end + end +end
Add a spec for HostContextMethods module
diff --git a/resque-job_logger.gemspec b/resque-job_logger.gemspec index abc1234..def5678 100644 --- a/resque-job_logger.gemspec +++ b/resque-job_logger.gemspec @@ -12,7 +12,7 @@ gem.summary = %q{A resque plugin which logs the time it takes a job's perform method to run.} gem.homepage = "https://github.com/toddthomas/resque-job_logger" - gem.add_dependency "resque", "~> 1.23.1" + gem.add_dependency "resque", "~> 1.25" gem.add_development_dependency "rspec"
Update and loosen resque version requirements.
diff --git a/Casks/imageoptim.rb b/Casks/imageoptim.rb index abc1234..def5678 100644 --- a/Casks/imageoptim.rb +++ b/Casks/imageoptim.rb @@ -1,7 +1,7 @@ class Imageoptim < Cask - url 'http://imageoptim.com/ImageOptim.tbz2' + url 'http://imageoptim.com/ImageOptim1.4.1.2.tar.bz2' homepage 'http://imageoptim.com/' - version '1.4.0' - sha1 '2199d54cf1c781e48590b8047f55565aec07d74a' + version '1.4.1.2' + sha1 'dff8448cb4ff2ba754769db55cdd13ee88a10cf2' link :app, 'ImageOptim.app' end
Update cask to latest version. See https://twitter.com/pornelski/status/336639773382950913
diff --git a/Casks/vagrant127.rb b/Casks/vagrant127.rb index abc1234..def5678 100644 --- a/Casks/vagrant127.rb +++ b/Casks/vagrant127.rb @@ -3,8 +3,9 @@ sha256 '75c720eda0cbe6b2a2b19e38757ba4c34fbc57095ab4cc1459609bd242418129' url "http://files.vagrantup.com/packages/7ec0ee1d00a916f80b109a298bab08e391945243/Vagrant-#{version}.dmg" - homepage 'http://www.vagrantup.com' - license :unknown + name 'Vagrant' + homepage 'https://www.vagrantup.com' + license :mit pkg 'Vagrant.pkg' uninstall :script => { :executable => 'uninstall.tool', :input => %w[Yes] }
Vagrant127: Add name, update license and homepage
diff --git a/lib/recurring.rb b/lib/recurring.rb index abc1234..def5678 100644 --- a/lib/recurring.rb +++ b/lib/recurring.rb @@ -11,7 +11,7 @@ #websites = DailyRank.select(:domain).distinct domains = Domain.includes(:ranks) domains.each do |domain| - url = website.try(:domain) + url = domain.try(:name) if domain.ranks.last.date != Date.today doc = Nokogiri::HTML(open(base_url + url)) new_rank = doc.at_css("strong.metrics-data.align-vmiddle").text.gsub(/\s+/,'')
Fix bug - undefined variable 'website'
diff --git a/lib/remindice.rb b/lib/remindice.rb index abc1234..def5678 100644 --- a/lib/remindice.rb +++ b/lib/remindice.rb @@ -17,7 +17,11 @@ end end class Commands < Thor - @@tasks = if File.exists?(Remindice::TASK_FILENAME); File.readlines(Remindice::TASK_FILENAME) else [] end + if File.exists?(Remindice::TASK_FILENAME) + @@tasks = File.readlines(Remindice::TASK_FILENAME).map{|i| i.chomp} + else + @@tasks = [] + end desc 'add TASKS', 'Add tasks' def add(*task)
Split a class variable declaration It was too long
diff --git a/app/mailers/contact_mailer.rb b/app/mailers/contact_mailer.rb index abc1234..def5678 100644 --- a/app/mailers/contact_mailer.rb +++ b/app/mailers/contact_mailer.rb @@ -1,5 +1,5 @@ class ContactMailer < ActionMailer::Base - default from: "contact@mail.cgbc-nc.com" + default from: "CGBC-Web <contact@mail.cgbc-nc.com>" def default_emails ['emb1234@gmail.com']
Clean up display name when sending emails
diff --git a/app/mailers/teacher_mailer.rb b/app/mailers/teacher_mailer.rb index abc1234..def5678 100644 --- a/app/mailers/teacher_mailer.rb +++ b/app/mailers/teacher_mailer.rb @@ -2,11 +2,13 @@ default from: "leap@southdevon.ac.uk" def email_teacher(teacher, learner, register_event, slot) - @teacher = teacher - @learner = learner - @register_event = register_event - @slot = slot - mail(to: @teacher.college_email, subject: 'Student Absence') + if teacher.present? + @teacher = teacher + @learner = learner + @register_event = register_event + @slot = slot + mail(to: @teacher.college_email, subject: 'Student Absence') + end end end
Check for presence of teacher before sending email
diff --git a/rails/spec/requests/home_controller_spec.rb b/rails/spec/requests/home_controller_spec.rb index abc1234..def5678 100644 --- a/rails/spec/requests/home_controller_spec.rb +++ b/rails/spec/requests/home_controller_spec.rb @@ -16,7 +16,12 @@ it "#search" do compare("/search.php") + # Goes direct to MP page (only one MP covered by this postcode) + compare("/search.php?query=2088&button=Search") + # Two electorates cover this postcode compare("/search.php?query=2042&button=Search") + # Bad postcode + # compare("/search.php?query=0000&button=Search") compare("/search.php?query=Tony+Abbott&button=Search") compare("/search.php?query=supplementary+explanatory+memorandum&button=Search") compare("/search.php?query=This+is+some+test+text&button=Search")
Add some varied postcode tests Broken postcode test commented out because #134
diff --git a/spec/ruby-progressbar/components/title_spec.rb b/spec/ruby-progressbar/components/title_spec.rb index abc1234..def5678 100644 --- a/spec/ruby-progressbar/components/title_spec.rb +++ b/spec/ruby-progressbar/components/title_spec.rb @@ -0,0 +1,12 @@+require 'rspectacular' +require 'ruby-progressbar/components/title' + +class ProgressBar +module Components +describe Title do + it 'can use the default title if none is specified' do + expect(Title.new.title).to eql Title::DEFAULT_TITLE + end +end +end +end
Tests: Add tests for the 'Title' component -------------------------------------------------------------------------------- Branch: refactor/massive-update Signed-off-by: Jeff Felchner <8a84c204e2d4c387d61d20f7892a2bbbf0bc8ae8@thekompanee.com>
diff --git a/core/db/migrate/20130414000512_update_name_fields_on_spree_credit_cards.rb b/core/db/migrate/20130414000512_update_name_fields_on_spree_credit_cards.rb index abc1234..def5678 100644 --- a/core/db/migrate/20130414000512_update_name_fields_on_spree_credit_cards.rb +++ b/core/db/migrate/20130414000512_update_name_fields_on_spree_credit_cards.rb @@ -1,7 +1,7 @@ class UpdateNameFieldsOnSpreeCreditCards < ActiveRecord::Migration def up if ActiveRecord::Base.connection.adapter_name.downcase.include? "mysql" - execute "UPDATE spree_credit_cards SET name = CONCAT(first_name, ' ', last_name)" + execute "UPDATE spree_credit_cards SET name = CONCAT_WS(' ', first_name, last_name)" else execute "UPDATE spree_credit_cards SET name = first_name || ' ' || last_name" end
Correct use of CONCAT() in very old migration In MySQL, CONCAT() will return NULL if any of the passed in arguments are NULL. There are scenarios in which a user might have a first or last name but not both. In this case, this migration could be losing data. Instead, we can use CONCAT_WS() which will simply skip NULL arguments. So we're less likely to lose data while maintaining the same result for all other cases.
diff --git a/test/mash_test.rb b/test/mash_test.rb index abc1234..def5678 100644 --- a/test/mash_test.rb +++ b/test/mash_test.rb @@ -1,7 +1,7 @@ require 'test_helper' # Tests -class HashieMashTest < MiniTest::Unit::TestCase +class HashieMashTest < MiniTest::Test def setup @mash = Hashie::Mash.new end
Test class changed due to warning
diff --git a/test/unix_test.rb b/test/unix_test.rb index abc1234..def5678 100644 --- a/test/unix_test.rb +++ b/test/unix_test.rb @@ -0,0 +1,26 @@+require File.expand_path("../lib/redic", File.dirname(__FILE__)) + +setup do + Redic.new(url: "unix:///tmp/redis.sock") +end + +test "normal commands" do |c| + c.call("SET", "foo", "bar") + + assert_equal "bar", c.call("GET", "foo") +end + +test "pipelining" do |c| + c.write("SET", "foo", "bar") + c.write("GET", "foo") + + assert_equal ["OK", "bar"], c.run +end + +test "multi/exec" do |c| + c.write("MULTI") + c.write("SET", "foo", "bar") + c.write("EXEC") + + assert_equal ["OK", "QUEUED", ["OK"]], c.run +end
Add basic unix test to make sure unix sockets work.
diff --git a/spec/centos/dirtycow_spec.rb b/spec/centos/dirtycow_spec.rb index abc1234..def5678 100644 --- a/spec/centos/dirtycow_spec.rb +++ b/spec/centos/dirtycow_spec.rb @@ -0,0 +1,9 @@+require 'spec_helper' + +# Test to ensure image is not vulnerable to CVE-2016-5195 +# Via: https://access.redhat.com/security/vulnerabilities/2706661 + +describe command("curl --silent --location https://access.redhat.com/sites/default/files/rh-cve-2016-5195_1.sh | bash -") do + its(:stdout) { should_not match /IS vulnerable/ } + its(:exit_status) { should eq 0 } +end
Add test for dirty cow CVE-2016-5195
diff --git a/spec/henson/settings_spec.rb b/spec/henson/settings_spec.rb index abc1234..def5678 100644 --- a/spec/henson/settings_spec.rb +++ b/spec/henson/settings_spec.rb @@ -19,6 +19,10 @@ shared = "#{Dir.pwd}/shared" expect(Henson::Settings.new[:path]).to eq(shared) end + + it "accepts a hash that will override the defaults" do + expect(Henson::Settings.new(:quiet => true)).to be_true + end end context "[]" do
Add tests for the new hash arg to Henson::Settings.new
diff --git a/spec/money_converter_spec.rb b/spec/money_converter_spec.rb index abc1234..def5678 100644 --- a/spec/money_converter_spec.rb +++ b/spec/money_converter_spec.rb @@ -13,15 +13,15 @@ context "configured with currencies" do let(:conversion_rates) do { - EUR: { - DKK: 7.46076, - USD: 1.11, - BITCOIN: 0.0047 + 'EUR' => { + 'DKK' => 7.46076, + 'USD' => 1.11885, + 'BITCOIN' => 0.0047 }, - DKK: { - EUR: 0.134033, - USD: 0.149708, - BITCOIN: 0.000649578 + 'DKK' => { + 'EUR' => 0.134033, + 'USD' => 0.149708, + 'BITCOIN' => 0.000649578 } } end
Use strings instead of symbols to match the given interface and updated EUR -> USD rate.
diff --git a/test/lib/gemfile_parser_test.rb b/test/lib/gemfile_parser_test.rb index abc1234..def5678 100644 --- a/test/lib/gemfile_parser_test.rb +++ b/test/lib/gemfile_parser_test.rb @@ -1,4 +1,5 @@ require "test_helper" +require_relative "../../lib/gemfile_parser" class GemfileParserTest < ActiveSupport::TestCase GEMFILE = File.read File.expand_path("../fixtures/gemfile", __dir__)
Fix uninitialized constant error in test
diff --git a/spec/features/spotchecks/spotcheck_page_displays_letter_to_be_sent_spec.rb b/spec/features/spotchecks/spotcheck_page_displays_letter_to_be_sent_spec.rb index abc1234..def5678 100644 --- a/spec/features/spotchecks/spotcheck_page_displays_letter_to_be_sent_spec.rb +++ b/spec/features/spotchecks/spotcheck_page_displays_letter_to_be_sent_spec.rb @@ -0,0 +1,25 @@+require 'rails_helper' + +RSpec.feature 'Spotcheck page displays letter to be sent', type: :feature do + + include Warden::Test::Helpers + Warden.test_mode! + + let(:user) { create :user } + + before do + login_as user + end + + let(:application) { create :application_full_remission } + let(:spotcheck) { create :spotcheck, application: application } + + scenario 'User navigates to the spot check page, which has all required details' do + visit spotcheck_path(spotcheck) + + within '.spotcheck-letter' do + expect(page).to have_content(application.full_name) + expect(page).to have_content(user.name) + end + end +end
Add feature test for the spotcheck page letter
diff --git a/lib/app/helpers/esi_helper.rb b/lib/app/helpers/esi_helper.rb index abc1234..def5678 100644 --- a/lib/app/helpers/esi_helper.rb +++ b/lib/app/helpers/esi_helper.rb @@ -11,7 +11,7 @@ env = ENV['RAILS_ENV'] # If we were passed a url... - if URI.extract(resource).any? + if resource =~ URI.regexp # ...fetch and render an external resource... case env when 'production'
Fix failing test for rendering internal resources.
diff --git a/app/controllers/admin/relationships_controller.rb b/app/controllers/admin/relationships_controller.rb index abc1234..def5678 100644 --- a/app/controllers/admin/relationships_controller.rb +++ b/app/controllers/admin/relationships_controller.rb @@ -1,6 +1,6 @@ class Admin::RelationshipsController < Admin::BaseController def index - @relationships = Relationship.all + @relationships = Relationship.order("connection_allowed ASC") end def new
Change order of relationships index so pending relationships are at the top
diff --git a/lib/better_logging/railtie.rb b/lib/better_logging/railtie.rb index abc1234..def5678 100644 --- a/lib/better_logging/railtie.rb +++ b/lib/better_logging/railtie.rb @@ -6,6 +6,7 @@ class Railtie < Rails::Railtie config.better_logging = ActiveSupport::OrderedOptions.new config.better_logging.enabled = ENV["BETTER_LOGGING"].present? + config.better_logging.ignore_controllers = [] if config.better_logging.enabled require "rails_12factor" @@ -16,6 +17,10 @@ config.lograge.formatter = JSONLogFormat config.lograge.custom_options = ->(event) do {request_id: event.payload[:request_id]} + end + Lograge.ignore ->(event) do + controller = event.payload[:params]["controller"] + Array(config.better_logging.ignore_controllers).include?(controller) end end
Allow passing controllers to ignore
diff --git a/config/initializers/_splunk_logger.rb b/config/initializers/_splunk_logger.rb index abc1234..def5678 100644 --- a/config/initializers/_splunk_logger.rb +++ b/config/initializers/_splunk_logger.rb @@ -1,5 +1,5 @@ if AppConfig[:enable_splunk_logging] require File.expand_path('../../../lib/log_overrider', __FILE__) + Rails.logger.class.send(:include, SplunkLogging) end -Rails.logger.class.send(:include, SplunkLogging)
Move the include of splunklogging into the appconfig check
diff --git a/app/models/qernel/plugins/merit/import_adapter.rb b/app/models/qernel/plugins/merit/import_adapter.rb index abc1234..def5678 100644 --- a/app/models/qernel/plugins/merit/import_adapter.rb +++ b/app/models/qernel/plugins/merit/import_adapter.rb @@ -14,14 +14,16 @@ elec_link.dataset_set(:calculated, true) end - # Recalculate the price per MJ. - total_price = - carrier.cost_curve.to_enum.with_index.sum do |price, index| - price * participant.load_at(index) - end + if (production = participant.production).positive? + # Recalculate the price per MJ. + total_price = + carrier.cost_curve.to_enum.with_index.sum do |price, index| + price * participant.load_at(index) + end - # Divide by production which is in MJ to set the cost per MJ. - carrier.dataset_set(:cost_per_mj, total_price / participant.production) + # Divide by production which is in MJ to set the cost per MJ. + carrier.dataset_set(:cost_per_mj, total_price / production) + end end private
Fix imported electricity cost_per_mj with zero production
diff --git a/app/overrides/add_return_requests_to_admin_tab.rb b/app/overrides/add_return_requests_to_admin_tab.rb index abc1234..def5678 100644 --- a/app/overrides/add_return_requests_to_admin_tab.rb +++ b/app/overrides/add_return_requests_to_admin_tab.rb @@ -0,0 +1,11 @@+Deface::Override.new( + virtual_path: 'spree/layouts/admin', + name: 'add_return_requests_to_admin_tab', + insert_top: '[data-hook="admin_tabs"]', + text: ' + <li class="tab-with-icon <%= params[:controller] == "spree/admin/return_requests" ? "selected" : "" %>"> + <%= link_to admin_return_requests_path, class: "icon_link with-tip icon-ambulance return_requests" do %> + <span class="text">Return Requests</span> + <% end %> + </li>', +)
Add Return Requests to admin tab
diff --git a/test/helper.rb b/test/helper.rb index abc1234..def5678 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -7,5 +7,6 @@ def setup url = File.join(File.dirname(__FILE__), 'fixtures', 'pegelstaende_neu.xml') Wasserstand.waterway_provider = PegelOnline::WaterwayProvider.new(url) + Wasserstand.level_provider = PegelOnline::LevelProvider.new(url) end end
Use local file for level test, too
diff --git a/test/helper.rb b/test/helper.rb index abc1234..def5678 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -9,7 +9,7 @@ end require 'minitest/autorun' require 'minitest/pride' -require 'mocha/setup' +require 'mocha/minitest' $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.dirname(__FILE__))
Replace 'mocha/setup' require with 'mocha/minitest'.
diff --git a/test/helper.rb b/test/helper.rb index abc1234..def5678 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -16,8 +16,8 @@ )) end -def read_api_file(path) - path = File.join(test_site.output_paths[:site], 'api', path) +def read_api_file(path = nil) + path = File.join(test_site.output_paths[:site], 'api', path, 'index.json') JSON.load(File.read(path)) end
Update read_api_file to assume the index.json part of the path.
diff --git a/lib/duty_calculator/dootie.rb b/lib/duty_calculator/dootie.rb index abc1234..def5678 100644 --- a/lib/duty_calculator/dootie.rb +++ b/lib/duty_calculator/dootie.rb @@ -1,5 +1,5 @@+# encoding: utf-8 module DutyCalculator - class Dootie < StandardError def initialize(data=nil) @data = data
Fix invalid double byte character error