diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/spec/models/github_utils_spec.rb b/spec/models/github_utils_spec.rb index abc1234..def5678 100644 --- a/spec/models/github_utils_spec.rb +++ b/spec/models/github_utils_spec.rb @@ -0,0 +1,20 @@+require "spec_helper" + +describe GithubUtils do + let(:token) { 'x' * 30 } + let(:user) { double(github_id: 'test', token: token) } + + context "when retrieving a user's repository list" do + let(:repos_instance) { double(Github::Repos.name) } + + before do + Github::Repos.stub(:new) { repos_instance } + repos_instance.should_receive(:auto_pagination=).with(true) + repos_instance.should_receive(:all).with(user: 'test') + end + + it "retrieves all of the user's repositories" do + GithubUtils.get_repos_list_for(user) + end + end +end
Add first spec around GithubUtils
diff --git a/object_patch.gemspec b/object_patch.gemspec index abc1234..def5678 100644 --- a/object_patch.gemspec +++ b/object_patch.gemspec @@ -18,7 +18,7 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] - spec.add_development_dependency "bundler", "~> 1.3" + spec.add_development_dependency "bundler", "~> 1.2" spec.add_development_dependency "coveralls" spec.add_development_dependency "simplecov" spec.add_development_dependency "rake"
Allow for older version of Gemfile
diff --git a/app/controllers/admins_controller.rb b/app/controllers/admins_controller.rb index abc1234..def5678 100644 --- a/app/controllers/admins_controller.rb +++ b/app/controllers/admins_controller.rb @@ -8,7 +8,13 @@ def show user = User.find(params[:id]) - @productions = user.productions + puts user.inspect + @productions = user.designed_productions if user.user_type == "Designer" + @productions = user.lead_productions if user.user_type == "Lead" + # @productions = user.master_electrician_productions if user.user_type == "ME" + # above method not currently working..... + puts @productions + render "productions/index" end def update
Add routing to productions view from Admin show one user's productions
diff --git a/app/controllers/events_controller.rb b/app/controllers/events_controller.rb index abc1234..def5678 100644 --- a/app/controllers/events_controller.rb +++ b/app/controllers/events_controller.rb @@ -5,7 +5,13 @@ end def create - Event.create(event_params) + @event = Event.new(event_params) + binding.pry + if @event.save + flash[:success] = "Event created!" + else + flash[:error] = "Error: Could not save Event. Please check your event" + end redirect_to events_path end
Add flash messages for event form
diff --git a/app/controllers/robots_controller.rb b/app/controllers/robots_controller.rb index abc1234..def5678 100644 --- a/app/controllers/robots_controller.rb +++ b/app/controllers/robots_controller.rb @@ -16,7 +16,7 @@ "Allow: /home", "Allow: /about", "Allow: /collections", - "Allow: /stem-resources/*" + "Allow: /resources/*" ] # @@ -24,7 +24,11 @@ # collections = Admin::Project.where(:public => true) collections.each do |collection| - lines.push("Allow: /#{collection.landing_page_slug}") + if collection.landing_page_slug && + !collection.landing_page_slug.blank? + + lines.push("Allow: /#{collection.landing_page_slug}") + end end #
Remove empty slug pages. Fix /resources/ URL. [#147440453]
diff --git a/app/models/concerns/capybara/guides/screenshotable.rb b/app/models/concerns/capybara/guides/screenshotable.rb index abc1234..def5678 100644 --- a/app/models/concerns/capybara/guides/screenshotable.rb +++ b/app/models/concerns/capybara/guides/screenshotable.rb @@ -3,8 +3,8 @@ module Screenshotable require 'mini_magick' - # TODO: Some elements are outside the screenshot area def save_screenshot(image_filename) + # TODO: fail gracefully if driver doesn't support save_screenshot session.driver.save_screenshot(image_filename, full: true) crop(image_filename) unless full_screenshot? end @@ -23,6 +23,10 @@ session.evaluate_script("document.evaluate('#{@element.path}', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.getBoundingClientRect()") end + def device_pixel_ratio + session.evaluate_script("window.devicePixelRatio") + end + def session return @element if @element.is_a? Capybara::Session @element.session @@ -30,7 +34,8 @@ def crop(image_filename) image = MiniMagick::Image.open(image_filename) - image.crop "#{element_data['width']}x#{element_data['height']}+#{element_data['left']}+#{element_data['top']}" + dpr = device_pixel_ratio + image.crop "#{element_data['width'] * dpr}x#{element_data['height'] * dpr}+#{element_data['left'] * dpr}+#{element_data['top'] * dpr}" image.write image_filename end end
Handle device pixel ratio for screenshots
diff --git a/app/workers/asset_manager_attachment_delete_worker.rb b/app/workers/asset_manager_attachment_delete_worker.rb index abc1234..def5678 100644 --- a/app/workers/asset_manager_attachment_delete_worker.rb +++ b/app/workers/asset_manager_attachment_delete_worker.rb @@ -1,8 +1,7 @@ class AssetManagerAttachmentDeleteWorker < WorkerBase def perform(attachment_data_id) attachment_data = AttachmentData.find_by(id: attachment_data_id) - return unless attachment_data.present? - return unless attachment_data.deleted? + return unless attachment_data.present? && attachment_data.deleted? delete_asset_for(attachment_data.file) if attachment_data.pdf?
Tidy up attachment delete worker
diff --git a/lib/event_calendar/engine.rb b/lib/event_calendar/engine.rb index abc1234..def5678 100644 --- a/lib/event_calendar/engine.rb +++ b/lib/event_calendar/engine.rb @@ -5,7 +5,9 @@ class Engine < ::Rails::Engine initializer 'event_calendar.setup_view_helpers' do |app| app.config.to_prepare do - ActionController::Base.send(:helper, ::EventCalendar::CalendarHelper) + # after migrating to 3.2 a line below works + # ActionController::Base.send(:helper, ::EventCalendar::CalendarHelper) + ActionView::Base.send(:include, ::EventCalendar::CalendarHelper) end end end
Fix to helper work with 3.* rails app
diff --git a/lib/heroics/configuration.rb b/lib/heroics/configuration.rb index abc1234..def5678 100644 --- a/lib/heroics/configuration.rb +++ b/lib/heroics/configuration.rb @@ -12,6 +12,7 @@ def initialize @options = {} @options[:cache] = 'Moneta.new(:Memory)' + @options[:default_headers] = {} yield self if block_given? end
Handle case where headers are not provided in config
diff --git a/demo/streamer_app.rb b/demo/streamer_app.rb index abc1234..def5678 100644 --- a/demo/streamer_app.rb +++ b/demo/streamer_app.rb @@ -10,7 +10,7 @@ class StreamerApp < Sinatra::Base get '/demo/:shop_id/products.:format/?' do |shop_id, format| - ids = repository(:products).adapter.query('SELECT id FROM products WHERE shop_id = ?', shop_id.to_i) + ids = repository(:products).adapter.select('SELECT id FROM products WHERE shop_id = ?', shop_id.to_i) page_size = params[:page_size].to_i if (format == 'csv') [200, {'content-type' => 'text/csv'}, CsvStreamer.new(Product,ids,nil,page_size)]
Use datamapper.select instead of .query.
diff --git a/lib/rasti/web/application.rb b/lib/rasti/web/application.rb index abc1234..def5678 100644 --- a/lib/rasti/web/application.rb +++ b/lib/rasti/web/application.rb @@ -33,7 +33,7 @@ env[PATH_PARAMS] = route.extract_params env['PATH_INFO'] route.endpoint.call env else - not_found + not_found env['REQUEST_METHOD'], env['PATH_INFO'] end end @@ -43,8 +43,8 @@ @rack ||= Rack::Builder.new end - def not_found - [404, {'Content-Type' => 'text/html'}, ['<h1>Not found</h1>']] + def not_found(method, path) + [404, {'Content-Type' => 'text/html'}, ["<h2>Not found</h2>#{method}: #{path}"]] end end
Improve page not found info
diff --git a/cocoapods.gemspec b/cocoapods.gemspec index abc1234..def5678 100644 --- a/cocoapods.gemspec +++ b/cocoapods.gemspec @@ -6,7 +6,7 @@ s.version = Pod::VERSION s.date = "2011-09-17" s.license = "MIT" - s.summary = "A simple Objective-C library package manager." + s.summary = "A simple Objective-C library package manager. (Requires MacRuby.)" s.email = "eloy.de.enige@gmail.com" s.homepage = "https://github.com/alloy/cocoapods" s.authors = ["Eloy Duran"]
Add MacRuby note to gemspec summary
diff --git a/lib/support_engine/engine.rb b/lib/support_engine/engine.rb index abc1234..def5678 100644 --- a/lib/support_engine/engine.rb +++ b/lib/support_engine/engine.rb @@ -7,6 +7,12 @@ g.fixture_replacement :factory_girl, :dir => 'spec/factories' g.assets false g.helper false + + initializer 'support_engine.action_view' do |app| + ActiveSupport.on_load :action_view do + ::ActionView::Base.send :include, SupportEngine::WidgetHelper + end + end end end end
Add widget helper to actionview
diff --git a/cookbooks/chef/attributes/default.rb b/cookbooks/chef/attributes/default.rb index abc1234..def5678 100644 --- a/cookbooks/chef/attributes/default.rb +++ b/cookbooks/chef/attributes/default.rb @@ -5,4 +5,4 @@ default[:chef][:server][:version] = "12.17.33" # Set the default client version -default[:chef][:client][:version] = "16.5.64" +default[:chef][:client][:version] = "16.6.14"
Update chef client to 16.6.14
diff --git a/config/metrics.rb b/config/metrics.rb index abc1234..def5678 100644 --- a/config/metrics.rb +++ b/config/metrics.rb @@ -31,8 +31,8 @@ code: code, method: env['REQUEST_METHOD'].downcase, host: env['HTTP_HOST'].to_s, - path: env['PATH_INFO'], - querystring: env['QUERY_STRING'], + path: aggregation.call(env['PATH_INFO']), + querystring: aggregation.call(env['QUERY_STRING']), route: env['sinatra.route'], app: "specialcollections" }
Use aggregation function to reduce cardinality in labels like path and querystring
diff --git a/spec/base_spec.rb b/spec/base_spec.rb index abc1234..def5678 100644 --- a/spec/base_spec.rb +++ b/spec/base_spec.rb @@ -1,7 +1,9 @@ require File.dirname(__FILE__) + '/spec_helper' describe Resourceful::Base, ".made_resourceful" do + before(:all) { @original_blocks = Resourceful::Base.made_resourceful.dup } before(:each) { Resourceful::Base.made_resourceful.replace [] } + after(:all) { Resourceful::Base.made_resourceful.replace @original_blocks } it "should store blocks when called with blocks and return them when called without a block" do 5.times { Resourceful::Base.made_resourceful(&should_be_called) }
Fix a nasty test bug that caused the integration tests to fail under ill-defined circumstances. git-svn-id: 30fef0787527f3d4b2d3639a5d6955e4dc84682e@160 c18eca5a-f828-0410-9317-b2e082e89db6
diff --git a/lib/coinmux/http.rb b/lib/coinmux/http.rb index abc1234..def5678 100644 --- a/lib/coinmux/http.rb +++ b/lib/coinmux/http.rb @@ -31,7 +31,7 @@ info "HTTP GET Response #{response.code}" raise Coinmux::Error, "Invalid response code: #{response.code}" if response.code.to_s != '200' - debug "HTTP GET Response Content #{response.content}" + # debug "HTTP GET Response Content #{response.content}" response.content end
Comment out loud debug message appending request body.
diff --git a/lib/maia/message.rb b/lib/maia/message.rb index abc1234..def5678 100644 --- a/lib/maia/message.rb +++ b/lib/maia/message.rb @@ -59,7 +59,7 @@ }.compact } - hash.merge!(priority: priority) if priority + hash.merge!(priority: priority.to_s) if priority hash.merge!(dry_run: true) if dry_run? hash.merge!(content_available: true) if content_available? hash
Call to_s on priority so symbols are supported
diff --git a/lib/resque/tasks.rb b/lib/resque/tasks.rb index abc1234..def5678 100644 --- a/lib/resque/tasks.rb +++ b/lib/resque/tasks.rb @@ -42,10 +42,13 @@ # Preload app files if this is Rails task :preload => :setup do - if defined?(Rails) && Rails.env == 'production' - Dir["#{Rails.root}/app/**/*.rb"].each do |file| - require file - end + if defined?(Rails) && Rails.respond_to?(:application) + # Rails 3 + Rails.application.eager_load! + elsif defined?(Rails::Initializer) + # Rails 2.3 + $rails_rake_task = false + Rails::Initializer.run :load_application_classes end end end
Use Rails eager loading for resque:preload
diff --git a/lib/rom-relation.rb b/lib/rom-relation.rb index abc1234..def5678 100644 --- a/lib/rom-relation.rb +++ b/lib/rom-relation.rb @@ -20,7 +20,7 @@ ManyTuplesError = Class.new(RuntimeError) # Represent an undefined argument - Undefined = Object.new.freeze + Undefined = Class.new.freeze # An empty frozen Hash useful for parameter default values EMPTY_HASH = {}.freeze
Use an instance of class to represent Undefined This gives nicer output for Undefined#inspect
diff --git a/lib/tasks/data.rake b/lib/tasks/data.rake index abc1234..def5678 100644 --- a/lib/tasks/data.rake +++ b/lib/tasks/data.rake @@ -10,6 +10,7 @@ Proposal.all.rename(:word_id => :wordset_id) Seq.all.rename(:word_id => :wordset_id) Proposal.where(_type: "ProposeNewWord").update_all(_type: "ProposeNewWordset") + Wordset.update_all(lang_id: Lang.first.id) end end
Rename rake task should assign language to all wordsets
diff --git a/lib/tracking_fwz.rb b/lib/tracking_fwz.rb index abc1234..def5678 100644 --- a/lib/tracking_fwz.rb +++ b/lib/tracking_fwz.rb @@ -1,5 +1,13 @@ require "tracking_fwz/version" module TrackingFwz - # Your code goes here... + class Engine < ::Rails::Engine + end + + mattr_accessor :model_devise + @@model_devise = nil + + def self.setup + yield self + end end
Update module, defined model_devise for config
diff --git a/config/sitemap.rb b/config/sitemap.rb index abc1234..def5678 100644 --- a/config/sitemap.rb +++ b/config/sitemap.rb @@ -1,5 +1,7 @@ # Set the host name for URL creation -SitemapGenerator::Sitemap.default_host = "http://www.example.com" +SitemapGenerator::Sitemap.default_host = "https://yande.re" +SitemapGenerator::Sitemap.create_index = true +SitemapGenerator::Sitemap.namer = SitemapGenerator::SimpleNamer.new(:sitemap, :zero => "_index") SitemapGenerator::Sitemap.create do # Put links creation logic here. @@ -24,18 +26,11 @@ # Article.find_each do |article| # add article_path(article), :lastmod => article.updated_at # end -SitemapGenerator::Sitemap.default_host = "https://yande.re" + Post.available.pluck(:id).each do |post_id| + add "/post/show/#{post_id}", :changefreq => "daily" + end -SitemapGenerator::Sitemap.create_index = true -SitemapGenerator::Sitemap.namer = SitemapGenerator::SimpleNamer.new(:sitemap, :zero => '_index') - - - Post.available.pluck(:id).each do |post_id| - add "/post/show/#{post_id}", :changefreq => "daily" - end - - Tag.pluck(:name).each do |tag_name| - add "/post?#{{ :tag => tag_name }.to_param}", :changefreq => "daily" - end - + Tag.pluck(:name).each do |tag_name| + add "/post?#{{ :tag => tag_name }.to_param}", :changefreq => "daily" + end end
Fix indentation and move irrelevant configs.
diff --git a/Framezilla.podspec b/Framezilla.podspec index abc1234..def5678 100644 --- a/Framezilla.podspec +++ b/Framezilla.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |spec| spec.name = "Framezilla" - spec.version = "2.8.0" + spec.version = "2.9.0" spec.summary = "Comfortable syntax for working with frames." spec.homepage = "https://github.com/Otbivnoe/Framezilla"
Change the podspec version -> 2.9.0
diff --git a/spec/acceptance/support/test_ui.rb b/spec/acceptance/support/test_ui.rb index abc1234..def5678 100644 --- a/spec/acceptance/support/test_ui.rb +++ b/spec/acceptance/support/test_ui.rb @@ -3,7 +3,7 @@ METHODS = [:clear_line, :report_progress, :warn, :error, :info, :success] - def initialize(resource = nil) + def initialize super @messages = METHODS.each_with_object({}) { |m, h| h[m] = [] } end
Fix TestUI to work with Vagrant 1.2+
diff --git a/spec/aruba-doubles/history_spec.rb b/spec/aruba-doubles/history_spec.rb index abc1234..def5678 100644 --- a/spec/aruba-doubles/history_spec.rb +++ b/spec/aruba-doubles/history_spec.rb @@ -1,35 +1,37 @@ require 'spec_helper' -describe ArubaDoubles::History do - before do - PStore.stub(:new) - @history = ArubaDoubles::History.new('history.pstore') - end +module ArubaDoubles + describe History do + before do + PStore.stub(:new) + @history = History.new('history.pstore') + end - #TODO: Add examples to test the transactional stuff with PStore! + #TODO: Add examples to test the transactional stuff with PStore! - it 'should initialize a PStore with the filename' do - PStore.should_receive(:new).with('history.pstore') - ArubaDoubles::History.new('history.pstore') - end + it 'should initialize a PStore with the filename' do + PStore.should_receive(:new).with('history.pstore') + History.new('history.pstore') + end - describe '#to_s' do - it 'should return an inspection of the entries' do - @history.stub_chain(:to_a, :inspect).and_return('entries') - @history.to_s.should eql('entries') + describe '#to_s' do + it 'should return an inspection of the entries' do + @history.stub_chain(:to_a, :inspect).and_return('entries') + @history.to_s.should eql('entries') + end end - end - describe '#to_pretty' do - it 'should return a pretty representation to the entries' do - entries = [] - entries << ['foo'] - entries << ['foo', '--bar'] - entries << ['foo', '--bar', 'hello, world.'] - @history.stub(:to_a).and_return(entries) - @history.to_pretty.should eql(' 1 foo + describe '#to_pretty' do + it 'should return a pretty representation to the entries' do + entries = [] + entries << ['foo'] + entries << ['foo', '--bar'] + entries << ['foo', '--bar', 'hello, world.'] + @history.stub(:to_a).and_return(entries) + @history.to_pretty.should eql(' 1 foo 2 foo --bar 3 foo --bar hello,\ world.') + end end end end
Move history examples into module
diff --git a/spec/factories/contacts_factory.rb b/spec/factories/contacts_factory.rb index abc1234..def5678 100644 --- a/spec/factories/contacts_factory.rb +++ b/spec/factories/contacts_factory.rb @@ -8,11 +8,11 @@ end trait :with_email_address do - email_address { "eleanor@liverpool.uk" } + email_address { "#{SecureRandom.hex(10)}@liverpool.uk" } end trait :with_mobile_phone do - mobile_phone_number { "0123456789" } + mobile_phone_number { SecureRandom.random_number } end factory :contact_with_name_email, traits: [:with_name, :with_email_address]
Use random email and phone for mock contacts
diff --git a/spec/features/benchmarking_spec.rb b/spec/features/benchmarking_spec.rb index abc1234..def5678 100644 --- a/spec/features/benchmarking_spec.rb +++ b/spec/features/benchmarking_spec.rb @@ -3,7 +3,7 @@ describe 'benchmarking' do def do_things visit root_path - 1.times do + 5.times do find :css, 'h1' assert_text 'Capybara Driver Benchmarking!' click_button 'Here'
Set repetitions to a big enough number
diff --git a/spec/features/user_account_spec.rb b/spec/features/user_account_spec.rb index abc1234..def5678 100644 --- a/spec/features/user_account_spec.rb +++ b/spec/features/user_account_spec.rb @@ -5,14 +5,12 @@ it "Persists the user in the database" do visit root_path click_link_or_button "create_account" - within "#user_form" do - fill_in ".user_name", with: "zee" - fill_in ".email_address", with: "zee@example.com" - fill_in ".password", with: "password" - fill_in ".password_confirmation", with: "password" - click_link_or_button ".create_user" - end + fill_in "user_email", with: "zee@example.com" + fill_in "user_password", with: "password" + fill_in "user_password_confirmation", with: "password" + + click_link_or_button "Sign up" expect(page).to have_content("Account created for zee@examplecom") expect(User.exists?(email_address: "zee@example.com")).to be_truthy
Bring account creation test in line with devise defaults Since I didn't remember what Devise does by default, I had to change my test to match the form that it presents. To get these I used my browsers debugger tools to find the `id` attribute on each of the form fields. While you *can* use the content of the label (I.e "Email"); this makes your tests brittle. A designer or wordsmith may want to change the content; if so, it's better not to have to change your tests. When you introduce internationalization; you'll wind up needing to change quite a few tests as well. You'll notice I had to use the content for the "Sign up" button. This is because devise doesn't provide an id for the form submit button! Ah well.
diff --git a/spec/lib/octonore/template_spec.rb b/spec/lib/octonore/template_spec.rb index abc1234..def5678 100644 --- a/spec/lib/octonore/template_spec.rb +++ b/spec/lib/octonore/template_spec.rb @@ -48,7 +48,7 @@ template.should respond_to :update end - it "should get update data from Github" do + it "should be able to refresh data from Github" do template.source = nil template.update template.source.should_not equal nil
Reword it block of test.
diff --git a/spec/unit/custom_formatter_spec.rb b/spec/unit/custom_formatter_spec.rb index abc1234..def5678 100644 --- a/spec/unit/custom_formatter_spec.rb +++ b/spec/unit/custom_formatter_spec.rb @@ -1,14 +1,12 @@ # coding: utf-8 -require 'spec_helper' - -RSpec.describe TTY::ProgressBar, 'custom' do +RSpec.describe TTY::ProgressBar, 'custom formatter' do let(:output) { StringIO.new('', 'w+') } it "allows for custom tag" do progress = TTY::ProgressBar.new(":hi", output: output, total: 10) - HiFormatter = Class.new do + stub_const("HiFormatter", Class.new do def initialize(progress) @progress = progress end @@ -20,7 +18,7 @@ def format(value) value.gsub(/:hi/, "Hello") end - end + end) progress.use(HiFormatter) progress.advance
Change spec to properly handle constant.
diff --git a/lib/servitude/configuration.rb b/lib/servitude/configuration.rb index abc1234..def5678 100644 --- a/lib/servitude/configuration.rb +++ b/lib/servitude/configuration.rb @@ -37,6 +37,10 @@ end def from_file( file_path ) + unless File.exists?( file_path ) + raise "Configuration file #{file_path} does not exist" + end + options = Oj.load( File.read( file_path )) Servitude::NS::configuration = Servitude::NS::Configuration.new @@ -45,6 +49,8 @@ Servitude::NS::configuration.send( :"#{c}=", options[c] ) end end + + options[:config_loaded] = true end end
Add error handling in Configuration::from_file and set the config_loaded flag to true.
diff --git a/lib/cannon/app.rb b/lib/cannon/app.rb index abc1234..def5678 100644 --- a/lib/cannon/app.rb +++ b/lib/cannon/app.rb @@ -37,8 +37,8 @@ end def define_root - root_wd = @app_binding.eval("Dir.getwd()") - Cannon.send(:define_method, :root, -> { root_wd }) + root_dir = @app_binding.eval('File.expand_path(File.dirname(__FILE__))') + Cannon.send(:define_method, :root, -> { root_dir }) Cannon.send(:module_function, :root) end end
Improve Cannon.root ability to get root directory
diff --git a/LayerUIKit.podspec b/LayerUIKit.podspec index abc1234..def5678 100644 --- a/LayerUIKit.podspec +++ b/LayerUIKit.podspec @@ -22,5 +22,5 @@ s.ios.frameworks = 'UIKit' s.ios.deployment_target = '7.0' - s.dependency 'LayerKit', git: 'git@github.com:layerhq/LayerKit.git', :tag => 'v0.9.0-pre3 ' + s.dependency 'LayerKit', '~> 0.9.0' end
Use a valid version dependency for Podspec
diff --git a/gov_uk_date_fields.gemspec b/gov_uk_date_fields.gemspec index abc1234..def5678 100644 --- a/gov_uk_date_fields.gemspec +++ b/gov_uk_date_fields.gemspec @@ -8,7 +8,7 @@ s.name = "gov_uk_date_fields" s.version = GovUkDateFields::VERSION s.authors = ["Stephen Richards"] - s.email = ["stephen.richards@digital.justice.gov.uk"] + s.email = ["stephen@stephenrichards.eu"] s.homepage = "https://github.com/ministryofjustice/gov_uk_date_fields" s.summary = "Enable day-month-year text edit fields for form date entry" s.description = "Provides acts_as_gov_uk_date to mark Rails model attributes " +
Change email address on gemspec
diff --git a/app/controllers/api/v1/customers.rb b/app/controllers/api/v1/customers.rb index abc1234..def5678 100644 --- a/app/controllers/api/v1/customers.rb +++ b/app/controllers/api/v1/customers.rb @@ -38,6 +38,17 @@ current_customer.as_json(include: { discount_cards: { include: :barcode } }).to_json end + + desc "Update current customer's info" + put 'update' do + current_customer.first_name ||= params[:first_name] + current_customer.last_name ||= params[:last_name] + current_customer.country ||= params[:country] + current_customer.city ||= params[:city] + current_customer.phone_number ||= params[:phone_number] + current_customer.password ||= params[:password] + current_customer.save! + end end private
Add customer update API method
diff --git a/app/controllers/shows_controller.rb b/app/controllers/shows_controller.rb index abc1234..def5678 100644 --- a/app/controllers/shows_controller.rb +++ b/app/controllers/shows_controller.rb @@ -1,6 +1,6 @@ class ShowsController < ApplicationController def index - @year = params[:year] || DateTime.now.year + @year = params[:year] || DateTime.now.year.to_s @shows = Show.performed.for_year(@year) end
Set year to a string for now
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 @@ -1,7 +1,50 @@ class UsersController < ApplicationController def edit - redirect_to new_user_session_path unless user_signed_in? + if user_signed_in? + @user = current_user + authorize! :update, @user + else + redirect_to new_user_session_path + end + end - @user = current_user + def update + if user_signed_in? + @user = current_user + authorize! :update, @user + + @user.update_attributes params[:user] + + respond_with_bip @user + else + redirect_to new_user_session_path + end + end + + def change_icon + if user_signed_in? + @user = current_user + authorize! :update, @user + else + redirect_to new_user_session_path + end + end + + def upload_icon + if user_signed_in? + @user = current_user + authorize! :update, @user + + # if no user icon was specified + if params[:user].blank? + render :change_icon, :formats => [ :js ] + elsif @user.update_attributes params[:user] + render + else + render :change_icon, :formats => [ :js ] + end + else + redirect_to new_user_session_path + end end end
Update Users Controller for icon Update Add actions to the Users controller to handle updating the User's icon.
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 @@ -2,6 +2,7 @@ def show + @user = current_user @trips = @user.trips end
Fix typo in user controller
diff --git a/app/models/action_text/rich_text.rb b/app/models/action_text/rich_text.rb index abc1234..def5678 100644 --- a/app/models/action_text/rich_text.rb +++ b/app/models/action_text/rich_text.rb @@ -8,6 +8,6 @@ has_many_attached :embeds after_save do - self.embeds_attachments_blobs = body.attachments.map(&:attachable) + self.embeds_blobs = body.attachments.map(&:attachable) end end
Use the correct API for blob assignment
diff --git a/lib/avoid_metreon/haml_renderer.rb b/lib/avoid_metreon/haml_renderer.rb index abc1234..def5678 100644 --- a/lib/avoid_metreon/haml_renderer.rb +++ b/lib/avoid_metreon/haml_renderer.rb @@ -0,0 +1,18 @@+require 'haml' + +module AvoidMetreon + # A simple HAML renderer, that takes a template name and data. + class HamlRenderer + attr_reader :templates_path + + def initialize(templates_path:) + @templates_path = templates_path + end + + def render(template_name, locals) + file_name = File.join(templates_path, "#{template_name}.haml") + engine = Haml::Engine.new(File.read(file_name)) + engine.render(self, locals) + end + end +end
Add extremely simple HAML renderer. Allows you to render a file from the specified templates directory. Since it passes itself in as the render context, this allows partials to be rendered as well from within a template.
diff --git a/lib/chef/knife/node_environment.rb b/lib/chef/knife/node_environment.rb index abc1234..def5678 100644 --- a/lib/chef/knife/node_environment.rb +++ b/lib/chef/knife/node_environment.rb @@ -0,0 +1,55 @@+# +# Author:: Jimmy McCrory (<jimmy.mccrory@gmail.com>) +# Copyright:: Copyright (c) 2014 Jimmy McCrory +# License:: Apache License, Version 2.0 +# +# 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. +# + +require 'chef/knife' + +class Chef + class Knife + class NodeEnvironment < Knife + + deps do + require 'chef/node' + require 'chef/json_compat' + end + + banner "knife node environment NODE ENVIRONMENT" + + def run + if @name_args.size < 2 + ui.fatal "You must specify a node name and an environment." + show_usage + exit 1 + else + @node_name = @name_args[0] + @environment = @name_args[1] + end + + node = Chef::Node.load(@node_name) + + node.chef_environment = @environment + + node.save + + config[:attribute] = "chef_environment" + + output(format_for_display(node)) + end + + end + end +end
[CHEF-1910] Manage node environments with knife
diff --git a/lib/graphql/types/iso_8601_date.rb b/lib/graphql/types/iso_8601_date.rb index abc1234..def5678 100644 --- a/lib/graphql/types/iso_8601_date.rb +++ b/lib/graphql/types/iso_8601_date.rb @@ -6,7 +6,7 @@ # # Use it for fields or arguments as follows: # - # field :created_at, GraphQL::Types::ISO8601Date, null: false + # field :published_at, GraphQL::Types::ISO8601Date, null: false # # argument :deliver_at, GraphQL::Types::ISO8601Date, null: false #
Change misleading field name [ci skip]
diff --git a/jekyll-index-pages.gemspec b/jekyll-index-pages.gemspec index abc1234..def5678 100644 --- a/jekyll-index-pages.gemspec +++ b/jekyll-index-pages.gemspec @@ -22,7 +22,7 @@ spec.require_paths = ["lib"] spec.add_dependency("i18n", "~> 0.8") - spec.add_dependency("jekyll", "~> 3.3") + spec.add_dependency("jekyll", "~> 3.4.0") spec.add_development_dependency("bundler", "~> 1.14") spec.add_development_dependency("rake", "~> 10.0")
Fix Jekyll version below 3.5.0
diff --git a/lib/omise/util.rb b/lib/omise/util.rb index abc1234..def5678 100644 --- a/lib/omise/util.rb +++ b/lib/omise/util.rb @@ -7,7 +7,7 @@ module Util module_function def typecast(object) klass = begin - const_get(object["object"].capitalize) + Omise.const_get(object["object"].capitalize) rescue NameError OmiseObject end
Fix const_get is looking at the wrong place
diff --git a/rspec_test/spec/calc_spec.rb b/rspec_test/spec/calc_spec.rb index abc1234..def5678 100644 --- a/rspec_test/spec/calc_spec.rb +++ b/rspec_test/spec/calc_spec.rb @@ -1,17 +1,15 @@ require 'calc' RSpec.describe Calc do - before do - @calc = Calc.new - end + subject(:calc) { Calc.new } it "given 2 and 3, returns 5" do - expect(@calc.add(2, 3)).to eq(5) - expect(@calc.add(2, 3)).not_to eq(8) - expect(@calc.add(2, 3)).to be < 10 - expect(@calc.add(2, 3)).to be_between(1, 10).inclusive - expect(@calc).to respond_to(:add) - expect(@calc.add(2, 3).integer?).to be true - expect(@calc.add(2, 3)).to be_integer + expect(calc.add(2, 3)).to eq(5) + expect(calc.add(2, 3)).not_to eq(8) + expect(calc.add(2, 3)).to be < 10 + expect(calc.add(2, 3)).to be_between(1, 10).inclusive + expect(calc).to respond_to(:add) + expect(calc.add(2, 3).integer?).to be true + expect(calc.add(2, 3)).to be_integer end end
Change before def to subject
diff --git a/rubicure_fuzzy_match.gemspec b/rubicure_fuzzy_match.gemspec index abc1234..def5678 100644 --- a/rubicure_fuzzy_match.gemspec +++ b/rubicure_fuzzy_match.gemspec @@ -18,7 +18,7 @@ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] - spec.add_dependency "rubicure", "0.2.6" + spec.add_dependency "rubicure", "0.2.7" spec.add_dependency "fuzzy_match", "~> 2.1.0" spec.add_development_dependency "bundler", "~> 1.10"
Upgrade rubicure version to 0.2.7
diff --git a/pandoc-ruby.gemspec b/pandoc-ruby.gemspec index abc1234..def5678 100644 --- a/pandoc-ruby.gemspec +++ b/pandoc-ruby.gemspec @@ -6,8 +6,6 @@ Gem::Specification.new do |s| s.name = 'pandoc-ruby' s.version = '2.0.2' - - s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version= s.authors = ['William Melody'] s.date = '2017-09-17' s.description = 'Ruby wrapper for Pandoc' @@ -36,6 +34,5 @@ s.licenses = ['MIT'] s.require_paths = ['lib'] s.required_ruby_version = '>= 1.9.3' - s.rubygems_version = '1.8.25' s.summary = 'PandocRuby' end
Remove some optional attributes from gemspec. Remove unnecessary attributes to reduce maintenance overhead.
diff --git a/lib/berks_to_rightscale.rb b/lib/berks_to_rightscale.rb index abc1234..def5678 100644 --- a/lib/berks_to_rightscale.rb +++ b/lib/berks_to_rightscale.rb @@ -25,4 +25,6 @@ require 'fog' require 'thor' -require 'berks_to_rightscale/cli'+SafeYAML::OPTIONS[:deserialize_symbols] = true if defined? SafeYAML::OPTIONS + +require 'berks_to_rightscale/cli'
Work around safe_yaml's evil breakage of fog by setting SafeYAML::OPTIONS[:deserialize_symbols] if SafeYAML::OPTIONS is defined.
diff --git a/lib/cms_tags/categories.rb b/lib/cms_tags/categories.rb index abc1234..def5678 100644 --- a/lib/cms_tags/categories.rb +++ b/lib/cms_tags/categories.rb @@ -6,9 +6,7 @@ end def form_field(object_name, view, index) - options = { id: form_field_id, class: "form-control" } - - input = view.collection_check_boxes(:page, :page_category_ids, @categories, :id, :label, options) do |b| + input = view.collection_check_boxes(:page, :page_category_ids, @categories, :id, :label) do |b| view.content_tag(:div, class: "form-check form-check-inline") do view.concat b.check_box(class: "form-check-input") view.concat b.label(class: "form-check-label")
Remove option code that wasn't being applied and isn't required
diff --git a/spec/centos/network_spec.rb b/spec/centos/network_spec.rb index abc1234..def5678 100644 --- a/spec/centos/network_spec.rb +++ b/spec/centos/network_spec.rb @@ -8,7 +8,9 @@ it { should be_resolvable } end - +# With newer builds using sdc-vmtools these files are always created at boot +# Also, you would not be able to test the VM at all if they werent' there. +if attr[:version].to_i < 20140818 describe file('/etc/sysconfig/network-scripts/ifcfg-eth0') do it { should be_file } it { should contain 'DEVICE="eth0"' } @@ -22,3 +24,4 @@ it { should contain 'ONBOOT="yes"' } it { should contain 'BOOTPROTO="dhcp"' } end +end
Update network tests for sdc-vmtools and new build process
diff --git a/spec/data_set/sleep_spec.rb b/spec/data_set/sleep_spec.rb index abc1234..def5678 100644 --- a/spec/data_set/sleep_spec.rb +++ b/spec/data_set/sleep_spec.rb @@ -1,5 +1,29 @@ require 'spec_helper' describe RubyJawbone::DataSet::Sleep do - # + let(:date) { Date.new(2014, 1, 21) } + let(:bed_time) { Time.local(2014, 1, 20, 22, 59) } + let(:asleep_time) { Time.local(2014, 1, 20, 23, 11) } + let(:awake_time) { Time.local(2014, 1, 21, 8, 4) } + let(:total_time_asleep) { 27478 } + let(:total_time_awake) { 5222 } + let(:total_time_in_light_sleep) { 17338 } + let(:total_time_in_deep_sleep) { 10140 } + let(:times_woken_up) { 3 } + + let(:sleep) { RubyJawbone::DataSet::Sleep.new(date, bed_time, asleep_time, awake_time, total_time_asleep, total_time_awake, total_time_in_light_sleep, total_time_in_deep_sleep, times_woken_up) } + + describe "#initialize" do + it "receives the sleep values and sets them into the correct properties" do + expect(sleep.date).to eq date + expect(sleep.bed_time).to eq bed_time + expect(sleep.asleep_time).to eq asleep_time + expect(sleep.awake_time).to eq awake_time + expect(sleep.total_time_asleep).to eq total_time_asleep + expect(sleep.total_time_awake).to eq total_time_awake + expect(sleep.total_time_in_light_sleep).to eq total_time_in_light_sleep + expect(sleep.total_time_in_deep_sleep).to eq total_time_in_deep_sleep + expect(sleep.times_woken_up).to eq times_woken_up + end + end end
Add spec to describe initializing a sleep data set object with sleep values.
diff --git a/spec/geometry/point_spec.rb b/spec/geometry/point_spec.rb index abc1234..def5678 100644 --- a/spec/geometry/point_spec.rb +++ b/spec/geometry/point_spec.rb @@ -11,5 +11,13 @@ expect(point.abscissa).to eq(5) expect(point.ordinate).to eq(8) end + + it "should not be writeable" do + point = Geometry::Point.new(0,0) + expect{ + point.ordinate = 4 + point.abscissa = 5 + }.to raise_error(NoMethodError) + end end end
Write spec to Point class to check for read only
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index abc1234..def5678 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -0,0 +1,30 @@+require 'rails_helper' + +describe Project do + + describe "next" do + before do + @first = create(:project) + @second = create(:project) + @third = create(:project) + end + + it "returns the next project (sorted by id)" do + expect(@first.next).to eq(@second) + expect(@second.next).to eq(@third) + end + end + + describe "previous" do + before do + @first = create(:project) + @second = create(:project) + @third = create(:project) + end + + it "returns the previous project (sorted by id)" do + expect(@second.previous).to eq(@first) + expect(@third.previous).to eq(@second) + end + end +end
Add tests for project sorting
diff --git a/spec/models/session_spec.rb b/spec/models/session_spec.rb index abc1234..def5678 100644 --- a/spec/models/session_spec.rb +++ b/spec/models/session_spec.rb @@ -11,13 +11,13 @@ describe 'validate device_token presence' do context 'device present' do - subject { stub_model Session, device: :ios } + subject { described_class.new(device: :ios) } it { should validate_presence_of(:device_token) } end context 'device not present' do - subject { stub_model Session } + subject { described_class.new(device: nil) } it { should_not validate_presence_of(:device_token) } end
Replace stub_model with real instance
diff --git a/spec/pagetience/dsl_spec.rb b/spec/pagetience/dsl_spec.rb index abc1234..def5678 100644 --- a/spec/pagetience/dsl_spec.rb +++ b/spec/pagetience/dsl_spec.rb @@ -6,8 +6,6 @@ include PageObject include Pagetience end - -class SecondPage < FirstPage; end describe Pagetience::DSL do let(:browser) { mock_watir_browser }
Remove unused class in dsl spec
diff --git a/lib/geocoder/ip_address.rb b/lib/geocoder/ip_address.rb index abc1234..def5678 100644 --- a/lib/geocoder/ip_address.rb +++ b/lib/geocoder/ip_address.rb @@ -1,7 +1,8 @@ module Geocoder class IpAddress < String + def loopback? - (self == "0.0.0.0" or self.match(/\A127/)) + valid? and (self == "0.0.0.0" or self.match(/\A127\./)) end def valid?
Include validity as criterion for loopback.
diff --git a/jqgrid_rails.gemspec b/jqgrid_rails.gemspec index abc1234..def5678 100644 --- a/jqgrid_rails.gemspec +++ b/jqgrid_rails.gemspec @@ -11,6 +11,7 @@ s.require_path = 'lib' s.has_rdoc = true s.extra_rdoc_files = ['README.rdoc', 'LICENSE.rdoc', 'CHANGELOG.rdoc'] + s.add_dependency 'rails_javascript_helpers', '~> 1.0' s.add_dependency 'rails', '>= 2.3' s.files = %w(README.rdoc CHANGELOG.rdoc) + Dir.glob("{app,files,lib,rails}/**/*") end
Add dependency for javascript helpers
diff --git a/db/migrate/023_non_nullable_associations_timestamps.rb b/db/migrate/023_non_nullable_associations_timestamps.rb index abc1234..def5678 100644 --- a/db/migrate/023_non_nullable_associations_timestamps.rb +++ b/db/migrate/023_non_nullable_associations_timestamps.rb @@ -0,0 +1,11 @@+class NonNullableAssociationsTimestamps < ActiveRecord::Migration[4.2] + def change + [:playlist_tracks, + :album_tracks, + :track_artists, + :album_artists].each do |t| + change_column(t, :created_at, :timestamp, null: false, default: -> { 'NOW()' }) + change_column(t, :updated_at, :timestamp, null: false, default: -> { 'NOW()' }) + end + end +end
Add migration: Make non nullable timestamp of associtation tables
diff --git a/drugs.gemspec b/drugs.gemspec index abc1234..def5678 100644 --- a/drugs.gemspec +++ b/drugs.gemspec @@ -15,7 +15,7 @@ spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0").reject do |f| - f.match(%r{^(test|spec|features)/}) + f.match(%r{^(test/|spec/|features/|\.gitignore|\.npmignore|Makefile|Rakefile|index\.js|package\.json)}) end spec.bindir = "exe"
Exclude Node.js specific file from gemspec
diff --git a/FeedBunch-app/config/initializers/aws-sdk.rb b/FeedBunch-app/config/initializers/aws-sdk.rb index abc1234..def5678 100644 --- a/FeedBunch-app/config/initializers/aws-sdk.rb +++ b/FeedBunch-app/config/initializers/aws-sdk.rb @@ -1,18 +1,20 @@ # frozen_string_literal: true -require 'aws-sdk-s3' +if Rails.env == 'production' + require 'aws-sdk-s3' -# AWS log level defaults to :info, you can set a different level here -#Aws.config[:log_level] = :debug + # AWS log level defaults to :info, you can set a different level here + #Aws.config[:log_level] = :debug -# Configure AWS credentials -access_key = Rails.application.secrets.aws_access_key_id -secret = Rails.application.secrets.aws_secret_access_key -Aws.config[:credentials] = Aws::Credentials.new access_key, secret -Aws.config[:region] = Rails.application.secrets.aws_region + # Configure AWS credentials + access_key = Rails.application.secrets.aws_access_key_id + secret = Rails.application.secrets.aws_secret_access_key + Aws.config[:credentials] = Aws::Credentials.new access_key, secret + Aws.config[:region] = Rails.application.secrets.aws_region -# Name of the S3 bucket for storing objects. Can be changed with the AWS_S3_BUCKET -# environment variable, by default takes the value "feedbunch-<environment>", -# e.g. "feedbunch-production" in the production environment -s3_bucket = ENV.fetch("AWS_S3_BUCKET") { "feedbunch-#{Rails.env}" } -Feedbunch::Application.config.s3_bucket = s3_bucket+ # Name of the S3 bucket for storing objects. Can be changed with the AWS_S3_BUCKET + # environment variable, by default takes the value "feedbunch-<environment>", + # e.g. "feedbunch-production" in the production environment + s3_bucket = ENV.fetch("AWS_S3_BUCKET") { "feedbunch-#{Rails.env}" } + Feedbunch::Application.config.s3_bucket = s3_bucket +end
Initialize AWS-S3 only in production environment
diff --git a/app/models/game.rb b/app/models/game.rb index abc1234..def5678 100644 --- a/app/models/game.rb +++ b/app/models/game.rb @@ -3,5 +3,5 @@ had_many :venues, through: :gamevenues has_many :usergames has_many :users, through: :usergames - belongs_to :users + belongs_to :user end
Change users to user on belongs_to
diff --git a/app/models/page.rb b/app/models/page.rb index abc1234..def5678 100644 --- a/app/models/page.rb +++ b/app/models/page.rb @@ -5,6 +5,9 @@ named_scope :header_links, :conditions => ["show_in_header = ?", true], :order => 'position' named_scope :footer_links, :conditions => ["show_in_footer = ?", true], :order => 'position' + def link + foreign_link.blank? ? "/pages/" + slug : foreign_link + end private def not_using_foreign_link?
Add link method to Page model. Signed-off-by: Peter Berkenbosch <51b70fe95cd023174431b055755b7ef384a4462b@me.com>
diff --git a/app/models/post.rb b/app/models/post.rb index abc1234..def5678 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -10,7 +10,12 @@ post = user.posts.new post.message_id = mitt.message_id post.title = mitt.subject - post.body = mitt.body + post.body = if mitt.text_body.blank? + mitt.html_body + else + mitt.text_body + end + # post.photo = mitt.attachments.first.read unless mitt.attachments.empty? post.save else return false
Choose between html and text body
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 @@ -5,7 +5,7 @@ after_create :create_club - attr_accessible :name, :description, :email, :password, :password_confirmation, :remember_me + attr_accessible :name, :description, :email, :icon, :password, :password_confirmation, :remember_me has_many :clubs, :dependent => :destroy
Add icon as attr_accessible for User Update the User model to make the icon attribute attr_accessible for updates.
diff --git a/test/features/submit_event_test.rb b/test/features/submit_event_test.rb index abc1234..def5678 100644 --- a/test/features/submit_event_test.rb +++ b/test/features/submit_event_test.rb @@ -0,0 +1,73 @@+require 'test_helper' + +class SubmitEventTest < Capybara::Rails::TestCase + include CapybaraHelper + + setup do + @conference = create(:three_day_conference) + create(:call_for_participation, conference: @conference) + end + + def sign_up_steps + click_on 'Sign Up' + fill_in 'Email', with: @user.email + fill_in 'Password', with: @user.password + fill_in 'Password confirmation', with: @user.password + click_on 'Sign up' + assert_content page, 'A message with a confirmation link has been sent to your email address' + + User.last.confirm + end + + def sign_in_steps + click_on 'Log-in' + fill_in 'Email', with: @user.email + fill_in 'Password', with: @user.password + click_on 'Log in' + assert_content page, 'Signed in successfully' + end + + test 'sign up and sign in new submitter' do + @user = build(:user) + visit root_path + + sign_up_steps + sign_in_steps + + click_on 'Participate' + assert_content page, 'Personal details' + end + + test 'sign up and sign in new submitter to cfp' do + @user = build(:user) + visit "/#{@conference.acronym}/cfp" + + sign_up_steps + sign_in_steps + + assert_content page, 'Personal details' + end + + test 'submit an event' do + @user = create(:user) + + sign_in(@user.email, @user.password) + assert_content page, 'Signed in successfully' + + click_on 'Participate' + click_on 'Submit a new event', match: :first + + fill_in 'title', with: 'fake-title', match: :first + select '00:45', from: 'Time slots' + click_on 'Create event' + + assert_content page, 'Events you already submitted' + assert_content page, 'fake-title' + + click_on 'Edit availability', match: :first + assert_content page, 'Edit availability' + click_on 'Save availability' + assert_content page, 'Thank you for specifying your availability' + end +end +
Add test for submitter sign up, create event and availability
diff --git a/test/integration/home_page_test.rb b/test/integration/home_page_test.rb index abc1234..def5678 100644 --- a/test/integration/home_page_test.rb +++ b/test/integration/home_page_test.rb @@ -44,9 +44,7 @@ with_current_site(site) do visit @path - assert has_link?("By signing up you agree to the Privacy Policy") - privacy_page_link = find("a", text: "By signing up you agree to the Privacy Policy") - assert privacy_page_link[:href].include?(gobierto_cms_page_path(privacy_page.slug)) + assert has_no_link?("By signing up you agree to the Privacy Policy") end end end
Change test of subscription box in footer layout The test must be changed because bd2bc92a89 disables subscription box
diff --git a/asset_hash.gemspec b/asset_hash.gemspec index abc1234..def5678 100644 --- a/asset_hash.gemspec +++ b/asset_hash.gemspec @@ -3,7 +3,7 @@ Gem::Specification.new do |s| s.name = "asset_hash" s.summary = "Asset hasher for Cloudfront custom origin domain asset hosting." - s.description = "This gem allows you to copy your static assets to a versions including a unique hash in the filename. By using this and modifying your Rails asset path you can easily serve static content on Cloudfront using the custom origin policy." + s.description = "This gem allows you to copy your static assets to include a unique hash in their filename. By using this and modifying your Rails asset path you can easily enable your Rails application to serve static content using CloudFront with a custom origin policy." s.files = Dir["{app,lib,config}/**/*"] + ["MIT-LICENSE", "Rakefile", "Gemfile", "README.textile"] s.version = "0.1"
Update the description of the gemspec
diff --git a/serverspec/spec/ap/ap_configure_spec.rb b/serverspec/spec/ap/ap_configure_spec.rb index abc1234..def5678 100644 --- a/serverspec/spec/ap/ap_configure_spec.rb +++ b/serverspec/spec/ap/ap_configure_spec.rb @@ -1,5 +1,4 @@ require 'spec_helper' -require 'mysql2' require 'cloud_conductor_utils/consul' describe service('iptables') do @@ -7,41 +6,15 @@ end describe 'connect mysql' do - param = property[:consul_parameters] servers = property[:servers] db_host = servers.each_value.select do |server| server[:roles].include?('db') end.first - if param[:cloudconductor] && db_host[:private_ip] + if db_host[:private_ip] hostname = db_host[:private_ip] - - if param[:mysql_part] && param[:mysql_part][:app] && param[:mysql_part][:app][:username] - username = param[:mysql_part][:app][:username] - else - username = 'rails' - end - - if param[:mysql_part] && param[:mysql_part][:app] && param[:mysql_part][:app][:password] - password = param[:mysql_part][:app][:passowrd] - else - password = 'todo_replace_randompassword' - end - - if param[:mysql_part] && param[:mysql_part][:app] && param[:mysql_part][:app][:database] - database = param[:mysql_part][:app][:database] - else - database = 'rails' - end - - it do - expect do - Mysql2::Client.new( - host: hostname, - username: username, - password: password, - database: database) - end.to_not raise_error + describe command("hping3 -S #{hostname} -p 3306 -c 5") do + its(:stdout) { should match /sport=3306 flags=SA/ } end else
Fix db server connection example, use the hping3 instead mysql2 gem
diff --git a/brid.gemspec b/brid.gemspec index abc1234..def5678 100644 --- a/brid.gemspec +++ b/brid.gemspec @@ -4,8 +4,8 @@ Gem::Specification.new do |gem| gem.authors = ["Halan Pinheiro"] gem.email = ["halan.pinheiro@gmail.com"] - gem.description = %q{Brazilian identifications like CPF, CNPJ, Título de Eleitor} - gem.summary = %q{Brazilian identifications like CPF, CNPJ, Título de Eleitor} + gem.description = %q{Brazilian identifications like CPF, CNPJ, Titulo de Eleitor} + gem.summary = %q{Brazilian identifications like CPF, CNPJ, Titulo de Eleitor} gem.homepage = "" gem.files = `git ls-files`.split($\)
Cut off accents on gem descriptions
diff --git a/recipes/data_bag.rb b/recipes/data_bag.rb index abc1234..def5678 100644 --- a/recipes/data_bag.rb +++ b/recipes/data_bag.rb @@ -21,7 +21,7 @@ users = begin data_bag(bag) rescue => ex - Chef::Log.info("Data bag #{bag.join('/')} not found (#{ex}), so skipping") + Chef::Log.info("Data bag #{bag} not found (#{ex}), so skipping") [] end
Fix data bag missing error message.
diff --git a/recipes/firewall.rb b/recipes/firewall.rb index abc1234..def5678 100644 --- a/recipes/firewall.rb +++ b/recipes/firewall.rb @@ -41,3 +41,11 @@ action :allow notifies :enable, 'firewall[ufw]' end + +bash 'allow connections from docker0' do + user 'root' + cwd '/tmp' + code <<-EOH + /usr/sbin/ufw allow in on docker0 + EOH +end
Allow connections in on docker0.
diff --git a/lib/adapters/base.rb b/lib/adapters/base.rb index abc1234..def5678 100644 --- a/lib/adapters/base.rb +++ b/lib/adapters/base.rb @@ -9,7 +9,7 @@ end def dry? - @dry ||= @options.fetch(:dry) + @dry ||= @options.fetch(:dry, false) end end end
Fix adapters work without `dry` option
diff --git a/spec/appsignal/inactive_railtie_spec.rb b/spec/appsignal/inactive_railtie_spec.rb index abc1234..def5678 100644 --- a/spec/appsignal/inactive_railtie_spec.rb +++ b/spec/appsignal/inactive_railtie_spec.rb @@ -3,22 +3,26 @@ describe "Inactive Appsignal::Railtie" do it "should not insert itself into the middleware stack" do # This uses a hack because Rails really dislikes you trying to - # start multiple applications in one process. It is reliable though. - pid = fork do - Appsignal.stub(:active => false) - Rails.application = nil - instance_eval do - module MyTempApp - class Application < Rails::Application - config.active_support.deprecation = proc { |message, stack| } + # start multiple applications in one process. This works decently + # on every platform except JRuby, so we're disabling this test on + # JRuby for now. + unless RUBY_PLATFORM == "java" + pid = fork do + Appsignal.stub(:active => false) + Rails.application = nil + instance_eval do + module MyTempApp + class Application < Rails::Application + config.active_support.deprecation = proc { |message, stack| } + end end end + MyTempApp::Application.initialize! + + MyTempApp::Application.middleware.to_a.should_not include Appsignal::Middleware end - MyTempApp::Application.initialize! - - MyTempApp::Application.middleware.to_a.should_not include Appsignal::Middleware + Process.wait(pid) + raise 'Example failed' unless $?.exitstatus == 0 end - Process.wait(pid) - raise 'Example failed' unless $?.exitstatus == 0 end end
Disable inactive test for JRuby
diff --git a/spec/features/create_a_question_spec.rb b/spec/features/create_a_question_spec.rb index abc1234..def5678 100644 --- a/spec/features/create_a_question_spec.rb +++ b/spec/features/create_a_question_spec.rb @@ -0,0 +1,33 @@+require 'rails_helper' + +describe "Create a quetsion", type: :feature do + let(:question) { build(:question) } + before do + login_as create(:user) + exercise = create(:exercise) + visit new_exercise_question_url(exercise.id) + end + + context "whit valid attributes" do + subject do + fill_in "question_description", with: question.description + click_on "Criar" + end + + it "create the question" do + expect{ subject }.to change(Question, :count).by(1) + expect(page).to have_current_path(question_path(Question.first.id)) + end + end + + context "whit invalid attributes" do + subject do + click_on "Criar" + end + + it "doesn't create the exercise" do + expect{ subject }.to change(Question, :count).by(0) + expect(page).to have_selector("div.alert.alert-danger") + end + end +end
Add test to 'create test case' feature
diff --git a/lib/dough/helpers.rb b/lib/dough/helpers.rb index abc1234..def5678 100644 --- a/lib/dough/helpers.rb +++ b/lib/dough/helpers.rb @@ -6,31 +6,33 @@ module Dough module Helpers def method_missing(method_name, *args, &block) - helper = "Dough::Helpers::Renderer".constantize if args.first.class == String - options = helper_with_text method_name, *args + helper_with_text(method_name, *args) elsif args.first.class == Hash - options = helper_without_text method_name, *args + helper_without_text(method_name, *args) else super end - helper.new(options).render end private + + def helper + "Dough::Helpers::Renderer".constantize + end def helper_with_text method_name, *args text, optional_args = *args options = { helper_name: method_name.to_s, renderer: self, text: text } options.merge! optional_args if optional_args - options + helper.new(options).render end def helper_without_text method_name, *args optional_args = *args options = { helper_name: method_name.to_s, renderer: self } - optional_args.each { |arg| options.merge! arg } if optional_args - options + optional_args.each { |option| options.merge! option } if optional_args + helper.new(options).render end end end
Improve the readability of Dough::Helpers
diff --git a/lib/error_handler.rb b/lib/error_handler.rb index abc1234..def5678 100644 --- a/lib/error_handler.rb +++ b/lib/error_handler.rb @@ -19,9 +19,24 @@ def handle_standard_error(exception) if %w(production staging).include?(Rails.env) require "sentry-raven" + if publisher = introspect_publisher + Raven.user_context( + publisher_id: publisher.id, + brave_publisher_id: publisher.brave_publisher_id + ) + end Raven.capture_exception(exception) else Rails.logger.warn(exception) end end + + def introspect_publisher + if defined?(@publisher) && @publisher + return @publisher + end + if defined?(current_publisher) && current_publisher + return current_publisher + end + end end
Add Publisher sentry context to ErrorHandler
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 @@ -20,4 +20,16 @@ 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 end
Add a task to change id-like usernames
diff --git a/zxcvbn-ruby.gemspec b/zxcvbn-ruby.gemspec index abc1234..def5678 100644 --- a/zxcvbn-ruby.gemspec +++ b/zxcvbn-ruby.gemspec @@ -20,4 +20,12 @@ gem.add_development_dependency 'therubyracer' gem.add_development_dependency 'rspec' + + gem.metadata = { + "bug_tracker_uri" => "https://github.com/envato/zxcvbn-ruby/issues", + "changelog_uri" => "https://github.com/envato/zxcvbn-ruby/blob/master/CHANGELOG.md", + "documentation_uri" => "https://github.com/envato/zxcvbn-ruby/blob/master/README.md", + "homepage_uri" => "https://github.com/envato/zxcvbn-ruby", + "source_code_uri" => "https://github.com/envato/zxcvbn-ruby" + } end
Add gem metadata for unwrappr - https://guides.rubygems.org/specification-reference/#metadata - https://github.com/envato/unwrappr
diff --git a/lib/xapi/homework.rb b/lib/xapi/homework.rb index abc1234..def5678 100644 --- a/lib/xapi/homework.rb +++ b/lib/xapi/homework.rb @@ -1,5 +1,7 @@ module Xapi - # Homework gets all of a user's currently pending problems. + # Homework gets all of a user's currently pending problems, + # marking any new ones as fetched. + # TODO: this class violates command/query separation. Refactor. class Homework attr_reader :key, :languages, :path def initialize(key, languages, path)
Add note to self about refactoring Homework
diff --git a/hutch.gemspec b/hutch.gemspec index abc1234..def5678 100644 --- a/hutch.gemspec +++ b/hutch.gemspec @@ -1,7 +1,13 @@ require File.expand_path('../lib/hutch/version', __FILE__) Gem::Specification.new do |gem| - gem.add_runtime_dependency 'bunny', '>= 1.7.0' + if defined?(JRUBY_VERSION) + gem.platform = 'java' + gem.add_runtime_dependency 'march_hare', '>= 2.11.0' + else + gem.platform = Gem::Platform::RUBY + gem.add_runtime_dependency 'bunny', '>= 1.7.0' + end gem.add_runtime_dependency 'carrot-top', '~> 0.0.7' gem.add_runtime_dependency 'multi_json', '~> 1.5' gem.add_runtime_dependency 'activesupport', '>= 3.0'
Add march_hare as a runtime dependency if running under jruby
diff --git a/roles/nchc.rb b/roles/nchc.rb index abc1234..def5678 100644 --- a/roles/nchc.rb +++ b/roles/nchc.rb @@ -11,7 +11,7 @@ :hosted_by => "NCHC", :location => "Hsinchu, Taiwan", :networking => { - :nameservers => ["8.8.8.8", "8.8.4.4"], + :nameservers => ["140.110.16.1", "140.110.4.1"], :roles => { :external => { :zone => "nc"
Use local name servers on longma
diff --git a/spec/views/ideas_views_spec.rb b/spec/views/ideas_views_spec.rb index abc1234..def5678 100644 --- a/spec/views/ideas_views_spec.rb +++ b/spec/views/ideas_views_spec.rb @@ -19,6 +19,7 @@ describe "ideas/show.html.haml" do it "renders ideas/show" do + @idea = create(:idea) render :template => "ideas/show" expect(rendered).to render_template("ideas/show") end
Create an idea to show in idea view test. When the idea 'show' page is implemented, it will need an idea to show. Otherwise, everything on the page will be nil when trying to display idea information.
diff --git a/lib/earth/electricity/electric_utility.rb b/lib/earth/electricity/electric_utility.rb index abc1234..def5678 100644 --- a/lib/earth/electricity/electric_utility.rb +++ b/lib/earth/electricity/electric_utility.rb @@ -4,7 +4,7 @@ self.primary_key = "eia_id" belongs_to :state, :foreign_key => 'state_postal_abbreviation' - has_many :electric_markets + has_many :electric_markets, :foreign_key => :electric_utility_eia_id has_many :zip_codes, :through => :electric_markets col :eia_id, :type => :integer
Fix ElectricMarket => ElectricUtility relationship
diff --git a/lib/kubernetes-deploy/formatted_logger.rb b/lib/kubernetes-deploy/formatted_logger.rb index abc1234..def5678 100644 --- a/lib/kubernetes-deploy/formatted_logger.rb +++ b/lib/kubernetes-deploy/formatted_logger.rb @@ -19,8 +19,6 @@ end "[#{context}][#{namespace}]" - else - "" end l.formatter = proc do |severity, datetime, _progname, msg|
Remove superfluous else clause when logging with a prefix
diff --git a/lib/locomotive/common/plugins/notifier.rb b/lib/locomotive/common/plugins/notifier.rb index abc1234..def5678 100644 --- a/lib/locomotive/common/plugins/notifier.rb +++ b/lib/locomotive/common/plugins/notifier.rb @@ -4,10 +4,10 @@ class Notifier def initialize(exception) - exception.notifier.extend(UiDevNull) + exception.notifier.extend(SilentLogger) end - module UiWithBeep + module SilentLogger def fatal(*) nil # Locomotive::Steam::Logger.fatal args.first end
Change name of plugin sample
diff --git a/lib/stl_public_services/cli_controller.rb b/lib/stl_public_services/cli_controller.rb index abc1234..def5678 100644 --- a/lib/stl_public_services/cli_controller.rb +++ b/lib/stl_public_services/cli_controller.rb @@ -1,3 +1,19 @@ class StlPublicServices::CliController + def call + start + end + + def start + welcome_user + end + + def welcome_user + <<-WELCOME.gsub /^\s+/, "" + Welcome to the St. Louis Public Services Ruby + CLI Gem! To list all available information on + St. Louis City Public Services and Government + Departments, type "list". You can also type + "exit". + WELCOME end
Update Cli Class to include several methods to test that spec is working.
diff --git a/config/initializers/carrierwave.rb b/config/initializers/carrierwave.rb index abc1234..def5678 100644 --- a/config/initializers/carrierwave.rb +++ b/config/initializers/carrierwave.rb @@ -3,7 +3,6 @@ config.storage :fog config.fog_public = false config.fog_directory = ENV.fetch('S3_UPLOAD_BUCKET') - config.fog_authenticated_url_expiration = ENV.fetch('S3_URL_EXPIRY') config.fog_credentials = { provider: 'AWS', region: 'eu-west-1',
Remove URL expiry config value
diff --git a/lib/discordrb/errors.rb b/lib/discordrb/errors.rb index abc1234..def5678 100644 --- a/lib/discordrb/errors.rb +++ b/lib/discordrb/errors.rb @@ -11,14 +11,6 @@ end end - # Raised when a HTTP status code indicates a failure - class HTTPStatusError < RuntimeError - attr_reader :status - def initialize(status) - @status = status - end - end - # Raised when a message is over the character limit class MessageTooLong < RuntimeError; end
Remove HTTPStatusError as it's used nowhere anymore
diff --git a/lib/designernews/core_ext/string.rb b/lib/designernews/core_ext/string.rb index abc1234..def5678 100644 --- a/lib/designernews/core_ext/string.rb +++ b/lib/designernews/core_ext/string.rb @@ -1,7 +1,7 @@ class String - def truncate(position, omission = '…') + def truncate(position) if self.length > position - self.slice(0, position).concat(omission) + self.slice(0, position).concat('…') else self end
Set ellipsis as the only truncation character
diff --git a/lib/geocoder/railtie.rb b/lib/geocoder/railtie.rb index abc1234..def5678 100644 --- a/lib/geocoder/railtie.rb +++ b/lib/geocoder/railtie.rb @@ -4,7 +4,7 @@ if defined? Rails::Railtie require 'rails' class Railtie < Rails::Railtie - initializer 'geocoder.insert_into_active_record' do + initializer 'geocoder.insert_into_active_record', before: :load_config_initializers do ActiveSupport.on_load :active_record do Geocoder::Railtie.insert end
Update Railtie initializer to run before config intializers
diff --git a/lib/excon/middlewares/idempotent.rb b/lib/excon/middlewares/idempotent.rb index abc1234..def5678 100644 --- a/lib/excon/middlewares/idempotent.rb +++ b/lib/excon/middlewares/idempotent.rb @@ -7,8 +7,8 @@ # reduces remaining retries, reset connection, and restart request_call datum[:retries_remaining] -= 1 connection = datum.delete(:connection) - retry_datum = datum.reject {|key, _| !VALID_REQUEST_KEYS.include?(key) } - connection.request(retry_datum) + datum.reject! {|key, _| !VALID_REQUEST_KEYS.include?(key) } + connection.request(datum) else @stack.error_call(datum) end
Revert "avoid mutating datum in idempontent" This reverts commit dc635a574ab70385e2fecc05d41a67e4b2636214.
diff --git a/lib/pacto/core/contract_registry.rb b/lib/pacto/core/contract_registry.rb index abc1234..def5678 100644 --- a/lib/pacto/core/contract_registry.rb +++ b/lib/pacto/core/contract_registry.rb @@ -1,6 +1,6 @@ module Pacto class ContractRegistry - def register_contract(contract = nil, *tags) + def register_contract(contract, *tags) tags << :default if tags.empty? tags.uniq.each do |tag|
Remove default value for register_contract There is no need to register a nil contract
diff --git a/lib/pebbles/tokyu_ruby_kaigi/cli.rb b/lib/pebbles/tokyu_ruby_kaigi/cli.rb index abc1234..def5678 100644 --- a/lib/pebbles/tokyu_ruby_kaigi/cli.rb +++ b/lib/pebbles/tokyu_ruby_kaigi/cli.rb @@ -10,7 +10,7 @@ puts "#{date.strftime("%Y/%m/%d(%a)")}" end - desc "take LIMIT", "show target days of TokyuRubyKaigi" + desc "take LIMIT", "show target days of TokyuRubyKaigi (default 10 days)" def take(limit=10) dates = Pebbles::TokyuRubyKaigi.take(limit) dates.each do |date|
Add default setting to help of take command.
diff --git a/lib/rorvswild/plugin/action_view.rb b/lib/rorvswild/plugin/action_view.rb index abc1234..def5678 100644 --- a/lib/rorvswild/plugin/action_view.rb +++ b/lib/rorvswild/plugin/action_view.rb @@ -17,6 +17,8 @@ RorVsWild::Section.stop do |section| section.kind = "view".freeze section.command = RorVsWild.agent.relative_path(payload[:identifier]) + section.file = section.command + section.line = 1 end end end
Replace view file by relative path.
diff --git a/lib/tasks/jmd_seed_rw_contests.rake b/lib/tasks/jmd_seed_rw_contests.rake index abc1234..def5678 100644 --- a/lib/tasks/jmd_seed_rw_contests.rake +++ b/lib/tasks/jmd_seed_rw_contests.rake @@ -0,0 +1,45 @@+namespace :jmd do + namespace :contests do + desc "Seed first-round (RW) contests for all hosts" + task seed_rw: :environment do + puts "What season would you like to seed RW contests for?" + season = STDIN.gets.strip.to_i + + puts "What competition year will the contests happen?" + year = STDIN.gets.strip.to_i + + puts "Please enter the comma-separate category ids for the contests:" + category_ids = STDIN.gets.strip.split(",").map(&:to_i) + + ActiveRecord::Base.transaction do + begin + Host.all.each do |host| + + contest = Contest.create!( + season: season, + round: 1, + host_id: host.id, + begins: DateTime.new(year, 1, 1), + ends: DateTime.new(year, 1, 1), + signup_deadline: DateTime.new(year - 1, 12, 15) + ) + + category_ids.each do |category_id| + category = Category.find(category_id) + ContestCategory.create!( + category_id: category.id, + contest_id: contest.id + ) + end + + puts "✓ Created contest #{contest.name} with contest categories" + end + rescue Exception => e + puts "✗ Could not seed contests as the following error occured:" + puts e + raise ActiveRecord::Rollback + end + end + end + end +end
Add rake task for seeding RW contests + contest categories for a season
diff --git a/lib/rdf/myrepository.rb b/lib/rdf/myrepository.rb index abc1234..def5678 100644 --- a/lib/rdf/myrepository.rb +++ b/lib/rdf/myrepository.rb @@ -6,6 +6,8 @@ def initialize(options = {}) #TODO: Configure initialization + # + # @statements = [] raise NotImplementedError end @@ -14,6 +16,8 @@ if block_given? #TODO: produce an RDF::Statement, then: # block.call(RDF::Statement) + # + # @statements.each do |s| block.call(s) end raise NotImplementedError else ::Enumerable::Enumerator.new(self,:each) @@ -22,13 +26,17 @@ # @see RDF::Mutable#insert_statement def insert_statement(statement) - #TODO: save the given RDF::Statement + #TODO: save the given RDF::Statement. Don't save duplicates. + # + #@statements.push(statement.dup) unless @statements.member?(statement) raise NotImplementedError end # @see RDF::Mutable#delete_statement def delete_statement(statement) - #TODO: delete the given RDF::Statement + #TODO: delete the given RDF::Statement from the repository. It's not an error if it doesn't exist. + # + # @statements.delete(statement) raise NotImplementedError end
Add a sample array implementation, commented out.
diff --git a/lib/rom/sql/commands.rb b/lib/rom/sql/commands.rb index abc1234..def5678 100644 --- a/lib/rom/sql/commands.rb +++ b/lib/rom/sql/commands.rb @@ -13,8 +13,8 @@ validation = validator.call(attributes) if validation.success? - id = relation.insert(attributes.to_h) - relation.where(id: id).first + pk = relation.insert(attributes.to_h) + relation.where(relation.model.primary_key => pk).first else validation end @@ -34,9 +34,9 @@ validation = validator.call(attributes) if validation.success? - ids = relation.map { |tuple| tuple[:id] } + pks = relation.map { |t| t[relation.model.primary_key] } relation.update(attributes.to_h) - relation.unfiltered.where(id: ids) + relation.unfiltered.where(relation.model.primary_key => pks) else validation end
Use primary_key for create/update rather than hardcoded :id
diff --git a/lib/support/requires.rb b/lib/support/requires.rb index abc1234..def5678 100644 --- a/lib/support/requires.rb +++ b/lib/support/requires.rb @@ -2,6 +2,7 @@ require 'optparse' require 'raml_parser' require 'json' +require 'fileutils' module RamlPoliglota module Support
Add source requirement to fileutils module.
diff --git a/lib/snmpjr.rb b/lib/snmpjr.rb index abc1234..def5678 100644 --- a/lib/snmpjr.rb +++ b/lib/snmpjr.rb @@ -1,5 +1,20 @@ require "snmpjr/version" +require "snmpjr/pdu" +require "snmpjr/session" +require "snmpjr/target" -module Snmpjr - # Your code goes here... +class Snmpjr + + def initialize options = {} + @host = options.fetch(:host) + @port = options.fetch(:port) || 161 + @community = options.fetch(:community) + end + + def get oid + target = Snmpjr::Target.new(:host => @host, :port => @port, :community => @community) + pdu = Snmpjr::Pdu.new oid + Snmpjr::Session.new.send target, pdu + end + end
Implement get top level method