diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index abc1234..def5678 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -24,7 +24,7 @@ private def markdown_renderer - @markdown_renderer ||= Redcarpet::Markdown.new(Redcarpet::Render::XHTML, + @markdown_renderer ||= Redcarpet::Markdown.new(Redcarpet::Render::XHTML.new(filter_html: true), autolink: true, space_after_headers: true, tables: true,
Add markdown filter for html prevents cross site attacks
diff --git a/app/jobs/transcode_episode_job.rb b/app/jobs/transcode_episode_job.rb index abc1234..def5678 100644 --- a/app/jobs/transcode_episode_job.rb +++ b/app/jobs/transcode_episode_job.rb @@ -3,14 +3,13 @@ queue_as :default def perform(episode) - if episode.audio_file_url.present? - transcoder.create_job( - pipeline_id: secrets.aws_audio_pipeline_id, - input: { key: episode.audio_file_url }, - output: { key: episode.audio_file_url.gsub(/wav/, 'm3u8') } - ) - episode.update transcoded: true - end + return unless episode.audio_file_url.present? + transcoder.create_job( + pipeline_id: secrets.aws_audio_pipeline_id, + input: { key: episode.audio_file_url }, + output: { key: episode.audio_file_url.gsub(/wav/, 'm3u8') } + ) + episode.update transcoded: true end private
Use a guard clause to return out of the method
diff --git a/lib/nform/helpers.rb b/lib/nform/helpers.rb index abc1234..def5678 100644 --- a/lib/nform/helpers.rb +++ b/lib/nform/helpers.rb @@ -1,7 +1,7 @@ module NForm module Helpers - def form_view(*args) - NForm::Builder.new(*args).render + def form_view(*args,&block) + NForm::Builder.new(*args).render &block end end end
Add missing block parameter to view helper
diff --git a/lib/library/utils.rb b/lib/library/utils.rb index abc1234..def5678 100644 --- a/lib/library/utils.rb +++ b/lib/library/utils.rb @@ -0,0 +1,93 @@+class Library + + module Utils + extend self + + # + # TODO: Not sure RUBYLIB environment should be included in user_path. + # + + # + # Lookup a path in locations that were added to $LOAD_PATH manually. + # These include those added via `-I` command line option, the `RUBYLIB` + # environment variable and those add to $LOAD_PATH via code. + # + # This is a really throwback to the old load system. But it is necessary as + # long as the old system is used, to ensure expected behavior. + # + # @return [String] + def find_userpath(path, options) + find_path(user_path, path, options) + end + + # + # Find a path in the given load paths, taking into account load options. + # + # @return [String] + # + def find_path(loadpath, pathname, options) + return nil if loadpath.empty? + + suffix = options[:suffix] || options[:suffix].nil? + #suffix = true if options[:require] # TODO: Is this always true? + suffix = false if SUFFIXES.include?(::File.extname(pathname)) # TODO: Why not just add '' to SUFFIXES? + + suffixes = suffix ? SUFFIXES : SUFFIXES_NOT + + loadpath.each do |lpath| + suffixes.each do |ext| + f = ::File.join(lpath, pathname + ext) + return f if ::File.file?(f) + end + end + + return nil + end + + # + # Lookup a path in locations that were added to $LOAD_PATH manually. + # These include those added via `-I` command line option, the `RUBYLIB` + # environment variable and those add to $LOAD_PATH via code. + # + # @return [Array<String>] + # + def user_path + load_path = $LOAD_PATH - ruby_library_locations + load_path = load_path.reject{ |p| gem_paths.any?{ |g| p.start_with?(g) } } + end + + # + # Ruby library locations as given in RbConfig. + # + # @return [Array<String>] + # + def ruby_library_locations + @_ruby_library_locations ||= ( + RbConfig::CONFIG.values_at( + 'rubylibdir', + 'archdir', + 'sitedir', + 'sitelibdir', + 'sitearchdir', + 'vendordir', + 'vendorlibdir', + 'vendorarchdir' + ) + ) + end + + # + # List of gem paths taken from the environment variable `GEM_PATH`, or failing + # that `GEM_HOME`. + # + # @todo Perhaps these should be taken directly from Gem module instead? + # + # @return [Array<String>] + # + def gem_paths + @_gem_paths ||= (ENV['GEM_PATH'] || ENV['GEM_HOME']).split(/[:;]/) + end + + end + +end
Add Utils module for sharing special functions.
diff --git a/lib/raven/sidekiq.rb b/lib/raven/sidekiq.rb index abc1234..def5678 100644 --- a/lib/raven/sidekiq.rb +++ b/lib/raven/sidekiq.rb @@ -22,6 +22,6 @@ end else Sidekiq.configure_server do |config| - config.error_handlers << Proc.new {|ex,context| Raven.capture_exception(ex, context) } + config.error_handlers << Proc.new {|ex,context| Raven.capture_exception(ex, :extra => {:sidekiq => context}) } end end
Isolate Sidekiq's own context info into :extra. Sidekiq sometimes sends a :context key as part of its error handling context hash. However, it means something entirely different than Raven's own :context key in options. Move all of Sidekiq's exception context into :extra so it doesn't confuse Raven.
diff --git a/lib/salt/template.rb b/lib/salt/template.rb index abc1234..def5678 100644 --- a/lib/salt/template.rb +++ b/lib/salt/template.rb @@ -6,7 +6,7 @@ def initialize(path) @slug = File.basename(path, File.extname(path)) - @contents = read_with_yaml(path) + @contents, @metadata = read_with_yaml(path) end def render(contents, context = {}) @@ -15,7 +15,7 @@ context['site'] ||= site output = Erubis::Eruby.new(@contents).evaluate(context) { contents } - output = site.render_template(@layout, output, context) if @layout + output = site.render_template(@metadata['layout'], output, context) if @metadata['layout'] output end
Use the metadata variable again, and use the layout metadata variable for rendering a parent, if any.
diff --git a/lib/rom/sql/types.rb b/lib/rom/sql/types.rb index abc1234..def5678 100644 --- a/lib/rom/sql/types.rb +++ b/lib/rom/sql/types.rb @@ -39,7 +39,7 @@ TypeDSL.new(value_type).call(&block) end - Serial = Int.meta(primary_key: true) + Serial = Integer.meta(primary_key: true) Blob = Constructor(Sequel::SQL::Blob, &Sequel::SQL::Blob.method(:new))
Update type, Int -> Integer
diff --git a/lib/sprockets/es6.rb b/lib/sprockets/es6.rb index abc1234..def5678 100644 --- a/lib/sprockets/es6.rb +++ b/lib/sprockets/es6.rb @@ -26,7 +26,10 @@ def call(input) data = input[:data] result = input[:cache].fetch(@cache_key + [data]) do - ES6to5.transform(data, @options) + ES6to5.transform(data, @options.merge( + 'filename' => input[:filename], + 'filenameRelative' => input[:name] + '.js', + )) end result['code'] end
Set filename options for ES6to5.transform * `filename` is required to show the proper filename on syntax errors * `filenameRelative` is used to build module ids (names) Without these options all files / modules will be named "unknown". Example: filename: '/app/assets/foo/bar/baz.es6.erb' filenameRelative: 'foo/bar/baz.js' moduleId: 'foo/bar/baz'
diff --git a/lita-console.gemspec b/lita-console.gemspec index abc1234..def5678 100644 --- a/lita-console.gemspec +++ b/lita-console.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |spec| spec.name = "lita-console" - spec.version = "0.0.2" + spec.version = "0.0.3" spec.authors = ["Mitch Dempsey"] spec.email = ["mrdempsey@gmail.com"] spec.description = %q{Provides a better shell adapter that allows for history} @@ -19,5 +19,5 @@ spec.add_development_dependency "rake" spec.add_development_dependency "rspec", ">= 3.0.0.beta2" - spec.metadata = { "lita_plugin_type" => "handler" } + spec.metadata = { "lita_plugin_type" => "adapter" } end
Correct plugin type in gemspec metadata.
diff --git a/lib/capybara_screenshot_idobata/rspec.rb b/lib/capybara_screenshot_idobata/rspec.rb index abc1234..def5678 100644 --- a/lib/capybara_screenshot_idobata/rspec.rb +++ b/lib/capybara_screenshot_idobata/rspec.rb @@ -9,12 +9,10 @@ CapybaraScreenshotIdobata.configure do |config| config.message_formatter = proc {|file, line, context| - example = context.respond_to?(:example) ? context.example : RSpec.current_example # For RSpec 2/3 conpatiblity - <<-MESSAGE Screenshot from: <code>#{ERB::Util.h(file)}:#{line}</code> <br> -<b>#{ERB::Util.h(example.full_description)}</b> +<b>#{ERB::Util.h(RSpec.current_example.full_description)}</b> MESSAGE } end
Remove the code for Rspec2 conpatibility
diff --git a/lib/generators/rails/templates/index.json.jbuilder b/lib/generators/rails/templates/index.json.jbuilder index abc1234..def5678 100644 --- a/lib/generators/rails/templates/index.json.jbuilder +++ b/lib/generators/rails/templates/index.json.jbuilder @@ -1,4 +1,4 @@ json.array!(@<%= plural_table_name %>) do |<%= singular_table_name %>| json.extract! <%= singular_table_name %>, <%= attributes_list %> json.url <%= singular_table_name %>_url(<%= singular_table_name %>, format: :json) -end+end
Add EOL to the generator template without this, Git claims "No newline at end of file"
diff --git a/lib/rake_tasks_for_rails/tasks/envs.rake b/lib/rake_tasks_for_rails/tasks/envs.rake index abc1234..def5678 100644 --- a/lib/rake_tasks_for_rails/tasks/envs.rake +++ b/lib/rake_tasks_for_rails/tasks/envs.rake @@ -0,0 +1,49 @@+require 'rake_tasks_for_rails/config' +require 'rake_tasks_for_rails/envs' + +namespace :envs do + + namespace :push do + + desc 'Add envs in .env and .env.staging to staging environment' + task :staging do + RakeTasksForRails::Envs.push(RakeTasksForRails::Config.staging_app_name, + RakeTasksForRails::Config::DEVELOPMENT_ENVIRONMENT) + end + + desc 'Add envs in .env and .env.production to production environment' + task :production do + RakeTasksForRails::Envs.push(RakeTasksForRails::Config.production_app_name, + RakeTasksForRails::Config::PRODUCTION_ENVIRONMENT) + end + + end + + desc "Default to 'envs:push:staging'" + task :push => 'envs:push:staging' + + namespace :print do + + desc 'Print envs in .env and .env.production' + task :development do + RakeTasksForRails::Envs.load_envs(RakeTasksForRails::Config::DEVELOPMENT_ENVIRONMENT) + end + + desc 'Print envs in .env and .env.staging' + task :staging do + RakeTasksForRails::Envs.load_envs(RakeTasksForRails::Config::STAGING_ENVIRONMENT) + end + + desc 'Print envs in .env and .env.production' + task :production do + RakeTasksForRails::Envs.load_envs(RakeTasksForRails::Config::PRODUCTION_ENVIRONMENT) + end + + end + + desc "Default to 'envs:print:development'" + task :print => 'envs:print:development' + + + +end
Move env-based tasks into their own rake file
diff --git a/lib/rock_rms/resources/payment_detail.rb b/lib/rock_rms/resources/payment_detail.rb index abc1234..def5678 100644 --- a/lib/rock_rms/resources/payment_detail.rb +++ b/lib/rock_rms/resources/payment_detail.rb @@ -25,6 +25,10 @@ def cast_payment_type(payment_type) case payment_type + when 'cash' + 6 + when 'check' + 9 when 'card' 156 when 'bank account', 'ach'
Support for cash and check as payment types
diff --git a/lib/tasks/user_database_host_update.rake b/lib/tasks/user_database_host_update.rake index abc1234..def5678 100644 --- a/lib/tasks/user_database_host_update.rake +++ b/lib/tasks/user_database_host_update.rake @@ -2,8 +2,8 @@ namespace :database_host do desc 'Add a text in the notification field for users filtered by field' task :update_dbm_and_redis, [:origin_ip, :dest_ip] => [:environment] do |_, args| - raise 'Origin IP argument is mandatory' unless args[:origin_ip].present? - raise 'Destination IP argument is mandatory' unless args[:dest_ip].present? + raise 'Origin IP parameter is mandatory' unless args[:origin_ip].present? + raise 'Destination IP parameter is mandatory' unless args[:dest_ip].present? affected_users = ::User.where(database_host: args[:origin_ip]).count # think about message @@ -29,6 +29,7 @@ ActiveRecord::Base.connection.execute(query) # update Redis + ::User.where(database_host: args[:dest_ip]).order(:id).paged_each { |u| u.save_metadata } end end
Update the redis part of the user
diff --git a/knife-cloudformation.gemspec b/knife-cloudformation.gemspec index abc1234..def5678 100644 --- a/knife-cloudformation.gemspec +++ b/knife-cloudformation.gemspec @@ -11,6 +11,6 @@ s.require_path = 'lib' s.add_dependency 'chef' s.add_dependency 'fog', '~> 1.12.1' - s.add_dependency 'attribute_struct', '~> 0.1.0' + s.add_dependency 'attribute_struct', '~> 0.1.2' s.files = Dir['**/*'] end
Set attribute_struct minimum dependency to 0.1.2
diff --git a/app/models/hashtag.rb b/app/models/hashtag.rb index abc1234..def5678 100644 --- a/app/models/hashtag.rb +++ b/app/models/hashtag.rb @@ -4,4 +4,11 @@ has_many :hashtag_questions has_many :questions, through: :hashtag_questions + before_save :tagize + + + private + def tagize + title.downcase!.gsub!(" ", "-") + end end
Make Tagize Method Far Hashtags Tagize turns an input into a more tag friendly format before it is saved. Needs to be further refined.
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 @@ -1,5 +1,5 @@ # coveralls.io and coco are incompatible. Run each in their own env. -if ENV["CI"] || ENV["JENKINS_URL"] || ENV['TDDIUM'] || ENV["COVERALLS_RUN_LOCALLY"] +if ENV['TRAVIS'] || ENV["CI"] || ENV["JENKINS_URL"] || ENV['TDDIUM'] || ENV["COVERALLS_RUN_LOCALLY"] # coveralls.io : web based code coverage require 'coveralls' Coveralls.wear!
Add TRAVIS env test for coveralls.io as well.
diff --git a/Casks/opera-next.rb b/Casks/opera-next.rb index abc1234..def5678 100644 --- a/Casks/opera-next.rb +++ b/Casks/opera-next.rb @@ -1,7 +1,7 @@ class OperaNext < Cask - url 'http://get.geo.opera.com/pub/opera-next/18.0.1284.26/mac/Opera_Next_18.0.1284.26_Setup.dmg' + url 'http://get.geo.opera.com/pub/opera-next/20.0.1387.59/mac/Opera_Next_20.0.1387.59_Setup.dmg' homepage 'http://www.opera.com/computer/next' - version '18.0.1284.26' - sha1 'e61e4e0960a2cb54dd9736b21720eea2b119af46' + version '20.0.1387.59' + sha256 '9052e043eecfa9b85aafd0cf6c5881994ca08bf034b2967765b9c56e6d8affd3' link 'Opera Next.app' end
Update Opera Next to 18.0.1284.26
diff --git a/test/models/user_invite_test.rb b/test/models/user_invite_test.rb index abc1234..def5678 100644 --- a/test/models/user_invite_test.rb +++ b/test/models/user_invite_test.rb @@ -1,15 +1,6 @@ require 'test_helper' class UserInviteTest < ActiveSupport::TestCase - - def setup - # create a mailer here and use it to call private functions - @user_invite = UserInvite.create!( - email: users(:user_two).email, - team: teams(:team_one) - ) - end - test "send email" do assert_difference 'ActionMailer::Base.deliveries.size', +1 do user_invites(:invite_one).send(:send_email)
Delete uneccessary creation of a UserInvite in the test
diff --git a/lib/appsignal/cli/helpers.rb b/lib/appsignal/cli/helpers.rb index abc1234..def5678 100644 --- a/lib/appsignal/cli/helpers.rb +++ b/lib/appsignal/cli/helpers.rb @@ -29,7 +29,7 @@ def press_any_key puts print " Ready? Press any key:" - stdin.getch + stdin.getc puts puts end
Fix "Press any key" on Microsoft Windows `getch` throws a `Errno::EBADF: Bad file descriptor` error on Microsoft Windows. I am unable to fix that. Using `getc` creates the same behavior and also works on Microsoft Windows. This fixes the "Press any key" prompts on Microsoft's OS, fixing the installer prompts.
diff --git a/stevenson.gemspec b/stevenson.gemspec index abc1234..def5678 100644 --- a/stevenson.gemspec +++ b/stevenson.gemspec @@ -6,8 +6,8 @@ Gem::Specification.new do |spec| spec.name = "stevenson" spec.version = Stevenson::VERSION - spec.authors = ["Dylan Karr"] - spec.email = ["dylan@RootsRated.com"] + spec.authors = ["RootsRated"] + spec.email = ["developers@rootsrated.com"] spec.summary = "Stevenson is a generator for Jekyll microsites created by RootsRated.com" spec.description = "Stevenson is a simple generator for microsites using Jekyll" spec.homepage = ""
Update gemspec author and email
diff --git a/rakelib/publish.rake b/rakelib/publish.rake index abc1234..def5678 100644 --- a/rakelib/publish.rake +++ b/rakelib/publish.rake @@ -27,4 +27,5 @@ sh("git commit -m 'Updating site to latest commit (#{git_short_sha})'") sh("git push") end + sh("aws s3 sync 'build/#{GOCD_VERSION}' s3://#{ENV['S3_BUCKET']}/#{GOCD_VERSION} --cache-control 'max-age=600' --acl public-read") end
Use aws cli to sync built files to s3.
diff --git a/spec/views/projects/index.html.erb_spec.rb b/spec/views/projects/index.html.erb_spec.rb index abc1234..def5678 100644 --- a/spec/views/projects/index.html.erb_spec.rb +++ b/spec/views/projects/index.html.erb_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -RSpec.describe 'projects/index', type: :view do +RSpec.describe 'projects/index.html.erb', type: :view do before(:each) do assign(:projects, [ FactoryGirl.create(:project), @@ -14,4 +14,27 @@ render end + it 'shows all details about a project' do + chair = FactoryGirl.create(:chair) + project = FactoryGirl.create(:project, chair_id: chair.id) + + project.update(status:true) + project.update(public:true) + + visit projects_path + + expect(page).to have_content(project.title) + expect(page).to have_content(l(project.created_at)) + expect(page).to have_content(chair.name) + + expect(page).to have_content(I18n.t('.public', default:'public')) + expect(page).to have_content(I18n.t('.active', default:'active')) + + project.update(status:false) + project.update(public:false) + visit projects_path + + expect(page).to have_content(I18n.t('.inactive', default:'inactive')) + expect(page).to have_content(I18n.t('.private', default:'private')) + end end
Add test for all details on the project side
diff --git a/test/controllers/bookings_controller_test.rb b/test/controllers/bookings_controller_test.rb index abc1234..def5678 100644 --- a/test/controllers/bookings_controller_test.rb +++ b/test/controllers/bookings_controller_test.rb @@ -11,6 +11,7 @@ end test 'should get new' do + get(new_booking_url) assert_response(:success) end
Reorder Gemfile and add yarn to setup
diff --git a/lib/jwplayer/rails/helper.rb b/lib/jwplayer/rails/helper.rb index abc1234..def5678 100644 --- a/lib/jwplayer/rails/helper.rb +++ b/lib/jwplayer/rails/helper.rb @@ -2,7 +2,7 @@ module Helper DEFAULT_OPTIONS = { id: 'jwplayer', - flashplayer: '/swf/player.swf', + flashplayer: '/assets/player.swf', width: '400', height: '300' }
Change location of flash player
diff --git a/lib/rabbit_wq/work_logger.rb b/lib/rabbit_wq/work_logger.rb index abc1234..def5678 100644 --- a/lib/rabbit_wq/work_logger.rb +++ b/lib/rabbit_wq/work_logger.rb @@ -32,7 +32,7 @@ end if worker - logger.send( level, "[" + Rainbow( "#{worker.class.name}:#{worker.object_id}" ).cyan + "] #{message}" ) + logger.send( level, "[[PID:" + Rainbow( Process.pid.to_s ).magenta + "]" + Rainbow( "#{worker.class.name}:#{worker.object_id}" ).cyan + "] #{message}" ) else logger.send( level, message ) end
Add PID of process to work logger.
diff --git a/lib/shapes/builder/struct.rb b/lib/shapes/builder/struct.rb index abc1234..def5678 100644 --- a/lib/shapes/builder/struct.rb +++ b/lib/shapes/builder/struct.rb @@ -25,7 +25,6 @@ struct.read_from_node struct.ident = node['ident'].to_s struct.description = node['description'].to_s - struct.resource_type = 'Struct' struct end end @@ -36,6 +35,7 @@ struct.ident = hash[:ident] struct.description = hash[:description] struct.struct_name = hash[:type] + struct.resource_type = 'Struct' build_children(hash).each do |child| struct << child end
Add resource-type in StructFromHash not in StructFromXml
diff --git a/lib/tasks/one_sheet/files.rb b/lib/tasks/one_sheet/files.rb index abc1234..def5678 100644 --- a/lib/tasks/one_sheet/files.rb +++ b/lib/tasks/one_sheet/files.rb @@ -1,9 +1,16 @@ module OneSheet class Files + extend Forwardable def self.read(type) new(type).read end + + def self.read_file(path, file) + lines = File.readlines(File.join(path, file[:file])) + lines[file[:from_line]..file[:to_line]].join << "\n" + end + private_class_method :read_file private_class_method :new @@ -12,19 +19,16 @@ @path = type[:path] end + def_delegator self, :read_file + def read files.reduce('') do |content, file| - content << read_file(*file) + content << read_file(path, file) end end private attr_reader :path, :files - - def read_file(file, from_line, to_line, line_break = "\n") - lines = File.readlines(File.join(path, file)) - lines[from_line..to_line].join << line_break - end end end
Make read_file a class method since it doesn't rely on state
diff --git a/week-9/ruby-review-2/ruby-review.rb b/week-9/ruby-review-2/ruby-review.rb index abc1234..def5678 100644 --- a/week-9/ruby-review-2/ruby-review.rb +++ b/week-9/ruby-review-2/ruby-review.rb @@ -0,0 +1,121 @@+# Introduction to Inheritance + +# I worked on this challenge [by myself, with: ]. + + +# Pseudocode +#create global and local cohort classes + +#global +# #attribute reader for name, start_date, immersive_date, graduation_date +# #currently_in_phase method +# input week_number +# IF week_number is between 0 and 9 +# return phase 0 +# IF week_number is between 10 and 13 +# return phase 1 +# IF week_number is between 13 and 17 +# return phase 2 +# if week_number is greater than 17 +# return graduated + +# graduated? method +# return currently_in_phase(week_number) == graduated + +# #local +# # attribute_reader for city, email_list +# # accessor students +# # initialize method +# takes variable number of names +# adds each name to students array +# adds email for each name to email list array +# #add method +# adds student to cohort students array +# adds email from email list +# #remove method +# removes student from cohort students array +# removes email from email list + +require 'date' + +# Initial Solution + +class GlobalCohort + attr_reader :name, :start_date + def initialize(name, start_date) + @name = name + @start_date = Date.new(start_date) + @immersive_date = start_date + 63 + @graduation = start_date + 126 + end + + def currently_in_phase() + end + + def graduated?() + date = Date.today + return date > @graduation + end + +end + +class LocalCohort < GlobalCohort + attr_reader :city + attr_accessor :email_list + attr_accessor :students + def initialize(city) + @city = city + @email_list = {} + @students = [] + end + + def add_student(student, email) + @students.push(student) + @email_list[student] = email + end + + def remove_student(student) + @students.delete(student) + @email_list.delete(student) + end + + def num_of_students + @students.length + end + +end + +squirells = GlobalCohort.new("Squirells", '2016, 11, 7') +chi = LocalCohort.new("Chicago") +puts squirells.start_date + + +chi.add_student("Meagan", "meagan@mail.com") +chi.add_student("Dave", "dave@mail.com") +chi.add_student("Joe", "joe@mail.com") +puts chi.students +puts chi.email_list + +chi.remove_student("Joe") +puts chi.students +puts chi.email_list +puts chi.num_of_students + +date = Date.today +date2 = date + 100 +puts date +puts date2 +puts date < date2 + +# puts squirells.immersive_date + + + + +# Refactored Solution + + + + + +# Reflection
Add initial Ruby Review files
diff --git a/library/erb/filename_spec.rb b/library/erb/filename_spec.rb index abc1234..def5678 100644 --- a/library/erb/filename_spec.rb +++ b/library/erb/filename_spec.rb @@ -2,7 +2,6 @@ require File.expand_path('../../../spec_helper', __FILE__) describe "ERB#filename" do - # TODO: why does this fail on rubinius? it "raises an exception if there are errors processing content" do filename = 'foobar.rhtml' erb = ERB.new('<% if true %>') # will raise SyntaxError @@ -20,15 +19,8 @@ @ex.message =~ /^(.*?):(\d+): / $1.should == expected $2.to_i.should == 1 - - # TODO: why is this different on rubinius? - extended_on :rubinius do - @ex.file.should == expected - @ex.line.should == 1 - end end - # TODO: why does this fail on rubinius? it "uses '(erb)' as filename when filename is not set" do erb = ERB.new('<% if true %>') # will raise SyntaxError lambda { @@ -44,11 +36,5 @@ @ex.message =~ /^(.*?):(\d+): / $1.should == expected $2.to_i.should == 1 - - # TODO: why is this different on rubinius? - extended_on :rubinius do - @ex.file.should == expected - @ex.line.should == 1 - end end end
Remove extended_on for missing functionality
diff --git a/buckaroo_json.gemspec b/buckaroo_json.gemspec index abc1234..def5678 100644 --- a/buckaroo_json.gemspec +++ b/buckaroo_json.gemspec @@ -18,8 +18,8 @@ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ['lib'] - spec.add_development_dependency 'bundler', '~> 1.10' - spec.add_development_dependency 'rake', '~> 10.0' + spec.add_development_dependency 'bundler' + spec.add_development_dependency 'rake' spec.add_development_dependency 'rspec' spec.add_development_dependency 'webmock' end
Update development dependencies in gemspec
diff --git a/lib/combi/reactor.rb b/lib/combi/reactor.rb index abc1234..def5678 100644 --- a/lib/combi/reactor.rb +++ b/lib/combi/reactor.rb @@ -14,8 +14,6 @@ log "------- starting EM reactor" EM::run do log "------- reactor started" - Signal.trap("INT") { EM::stop_event_loop } - Signal.trap("TERM") { EM::stop_event_loop } block.call unless block.nil? end log "------- reactor stopped"
Remove signal handlers. Let the OS kill EM
diff --git a/lib/idnow/helpers.rb b/lib/idnow/helpers.rb index abc1234..def5678 100644 --- a/lib/idnow/helpers.rb +++ b/lib/idnow/helpers.rb @@ -0,0 +1,9 @@+module Idnow + module Helpers + PROJECT_ROOT = File.dirname(File.dirname(File.dirname(__FILE__))) + + module Factories + Dir[File.join(PROJECT_ROOT, 'spec', 'support', 'factories', '*.rb')].each { |file| require(file) } + end + end +end
Add helper to load factories in other projects
diff --git a/lib/pandan/parser.rb b/lib/pandan/parser.rb index abc1234..def5678 100644 --- a/lib/pandan/parser.rb +++ b/lib/pandan/parser.rb @@ -13,7 +13,9 @@ def all_targets all_project_paths = workspace.file_references.map(&:path) - projects = all_project_paths.map { |project_path| Xcodeproj::Project.open(File.expand_path(project_path, @workspace_dir)) } + projects = all_project_paths.map do |project_path| + Xcodeproj::Project.open(File.expand_path(project_path, @workspace_dir)) + end projects.flat_map(&:targets).select { |target| target.name =~ /#{regex}/ } end end
Break long line down a bit to fix rubocop warning
diff --git a/lib/tasks/tasks.rake b/lib/tasks/tasks.rake index abc1234..def5678 100644 --- a/lib/tasks/tasks.rake +++ b/lib/tasks/tasks.rake @@ -5,4 +5,35 @@ binding.pry end + desc 'post-process LOINC Top 2000 common lab results CSV' + task :process_loinc, [] do |t, args| + require 'find' + require 'csv' + puts 'Looking for `./terminology/LOINC*.csv`...' + loinc_file = Find.find('terminology').find{|f| /LOINC.*\.csv$/ =~f } + if loinc_file + output_filename = 'terminology/scorecard_loinc_2000.txt' + puts "Writing to #{output_filename}..." + output = File.open(output_filename,'w:UTF-8') + line = 0 + begin + CSV.foreach(loinc_file, encoding: 'iso-8859-1:utf-8', headers: true) do |row| + line += 1 + next if row.length <=1 || row[1].nil? # skip the categories + # CODE | DESC | UCUM UNITS + output.write("#{row[1]}|#{row[2]}|#{row[6]}\n") + end + rescue Exception => e + puts "Error at line #{line}" + puts e.message + end + output.close + puts 'Done.' + else + puts 'LOINC file not found.' + puts 'Download the LOINC Top 2000 Common Lab Results file' + puts ' -> http://loinc.org/usage/obs/loinc-top-2000-plus-loinc-lab-observations-us.csv' + puts 'copy it into your `./terminology` folder, and rerun this task.' + end + end end
Add task to process LOINC codes.
diff --git a/lib/tumblargh/api.rb b/lib/tumblargh/api.rb index abc1234..def5678 100644 --- a/lib/tumblargh/api.rb +++ b/lib/tumblargh/api.rb @@ -23,8 +23,9 @@ def fetch(path, query={}) query.merge!(:api_key => api_key) url = "#{API_ROOT}#{path}?#{query.to_query}" - # puts "Fetching: #{url} ..." - ActiveSupport::JSON.decode( open(url).read )['response'] + resp = open(url).read + # TODO raise on API errors. + ActiveSupport::JSON.decode( resp )['response'] end end
Add TODO for API errors
diff --git a/update_commands.rb b/update_commands.rb index abc1234..def5678 100644 --- a/update_commands.rb +++ b/update_commands.rb @@ -0,0 +1,36 @@+#!/usr/bin/env ruby + +# Use this script to update the commands auto-completed in plugin/otto.vim. + +require 'open3' + +command_re = /^\s\s\s\s(\S+)/ +plugin_file = 'plugin/ottoproject.vim' + +# Create the list of commands. +stdout, stderr, _status = Open3.capture3('otto list-commands') +output = if stderr == '' + stdout.split("\n") + else + stderr.split("\n") + end +commands = output.collect do |l| + match = command_re.match(l) + " \\ \"#{match[1]}\"" if match +end.reject(&:nil?).join(",\n") + +# Read in the existing plugin file. +plugin = File.open(plugin_file, 'r').readlines + +# Replace the terraResourceTypeBI lines with our new list. +first = plugin.index { |l| /^ return join\(\[/.match(l) } + 1 +last = plugin.index { |l| /^ \\ \], "\\n"\)/.match(l) } +plugin.slice!(first, last - first) +commands.split("\n").reverse_each do |r| + plugin.insert(first, r) +end + +# Write the plugin file back out. +File.open(plugin_file, 'w') do |f| + f.puts plugin +end
Add script to update auto-completed commands
diff --git a/stream_controller.rb b/stream_controller.rb index abc1234..def5678 100644 --- a/stream_controller.rb +++ b/stream_controller.rb @@ -2,5 +2,9 @@ require 'rubygems' require 'daemons' +require 'bundler' +Bundler.setup + +Bundler.require Daemons.run(File.join(File.dirname(__FILE__), 'streaming.rb'))
Patch stream controller to work with new bundler
diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index abc1234..def5678 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -4,7 +4,7 @@ def create find_account! - @message = Message.new(message_params) + @message = CommandBarAction.new(message_params) if @message.save Analytics.track(
Use the command bar action class to parse the message
diff --git a/lita-weather.gemspec b/lita-weather.gemspec index abc1234..def5678 100644 --- a/lita-weather.gemspec +++ b/lita-weather.gemspec @@ -1,8 +1,8 @@ Gem::Specification.new do |spec| spec.name = "lita-weather" - spec.version = "0.1.0" - spec.authors = ["Gou Furuya"] - spec.email = ["innocent.zero@gmail.com"] + spec.version = "0.1.1" + spec.authors = ["Gou Furuya", "darkcat666"] + spec.email = ["innocent.zero@gmail.com", "holycat666@gmail.com"] spec.description = "Respond weather infromation" spec.summary = "Respond weather infromation" spec.homepage = "https://github.com/gouf/lita-weather"
Add author and bump up version
diff --git a/test/integration/managing_releases_test.rb b/test/integration/managing_releases_test.rb index abc1234..def5678 100644 --- a/test/integration/managing_releases_test.rb +++ b/test/integration/managing_releases_test.rb @@ -0,0 +1,53 @@+require 'integration_test_helper' + +class ManagingReleasesTest < ActionDispatch::IntegrationTest + + setup do + login_as_stub_user + end + + context "all releases" do + should "show today's releases" do + todays_releases = FactoryGirl.create_list(:release, 5, :deploy_at => Date.today.change(:hour => 12)) + + visit '/releases' + + within_table('today') do + todays_releases.each do |release| + assert page.has_link?("##{release.id}", :href => "/releases/#{release.id}") + assert page.has_content?(release.applications.map(&:name).join(', ')) + end + end + end + + should "show future releases" do + future_releases = FactoryGirl.create_list(:release, 5, :deploy_at => Date.today.tomorrow.change(:hour => 12)) + + visit '/releases' + + within_table('future') do + future_releases.each do |release| + assert page.has_link?("##{release.id}", :href => "/releases/#{release.id}") + assert page.has_content?(release.applications.map(&:name).join(', ')) + end + end + end + end + + context "a single release" do + setup do + @release = FactoryGirl.create(:release) + end + + should "show basic information about the release" do + visit "/releases/#{@release.id}" + + assert page.has_content?("Release #{@release.id}") + + within "dl" do + assert page.has_content?(@release.notes) + end + end + end + +end
Add integration test for releases
diff --git a/app/services/commits/change_service.rb b/app/services/commits/change_service.rb index abc1234..def5678 100644 --- a/app/services/commits/change_service.rb +++ b/app/services/commits/change_service.rb @@ -24,8 +24,12 @@ start_project: @start_project, start_branch_name: @start_branch) rescue Gitlab::Git::Repository::CreateTreeError - error_msg = "Sorry, we cannot #{action.to_s.dasherize} this #{@commit.change_type_title(current_user)} automatically. - This #{@commit.change_type_title(current_user)} may already have been #{action.to_s.dasherize}ed, or a more recent commit may have updated some of its content." + act = action.to_s.dasherize + type = @commit.change_type_title(current_user) + + error_msg = "Sorry, we cannot #{act} this #{type} automatically. " \ + "This #{type} may already have been #{act}ed, or a more recent " \ + "commit may have updated some of its content." raise ChangeError, error_msg end end
Correct error message returned by ChangeService Previously the string was spanning multiple lines and included a needless `\n` character in the resulting error message. This change also reduces duplication by assigning two variables.
diff --git a/app/workers/share_analytics_updater.rb b/app/workers/share_analytics_updater.rb index abc1234..def5678 100644 --- a/app/workers/share_analytics_updater.rb +++ b/app/workers/share_analytics_updater.rb @@ -9,8 +9,10 @@ uri = 'http://run.shareprogress.org/api/v1/buttons/analytics' uri = URI.parse(uri) - response = Net::HTTP.post_form(uri, {key: Settings.share_progress_api_key, id: button.sp_id}) - button.update(analytics: response.body ) + response = Net::HTTP.post_form(uri, {key: ENV['SHARE_PROGRESS_API_KEY'], id: button.sp_id}) + if response.success? + button.update(analytics: response.body ) + end end puts "Fetching has completed."
Update analytics if response was successful
diff --git a/contrib/sample-app/sample-app.rb b/contrib/sample-app/sample-app.rb index abc1234..def5678 100644 --- a/contrib/sample-app/sample-app.rb +++ b/contrib/sample-app/sample-app.rb @@ -23,7 +23,7 @@ # Calculate the Nth prime number to use up CPU and time post '/nth_prime' do - Prime.first(decode(request)['primes'].to_i).last + Prime.first(decode(request)['primes'].to_i).last.to_s end post '/post_json' do
Return a string for primes
diff --git a/config/application.rb b/config/application.rb index abc1234..def5678 100644 --- a/config/application.rb +++ b/config/application.rb @@ -4,7 +4,7 @@ require 'action_view/railtie' require 'sprockets/railtie' -Bundler.require(:default, Rails.env) +Bundler.require(*Rails.groups) module Frontend class Application < Rails::Application
Apply Rails 4.1 Bundler conventions
diff --git a/config/application.rb b/config/application.rb index abc1234..def5678 100644 --- a/config/application.rb +++ b/config/application.rb @@ -10,6 +10,8 @@ # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(:default, Rails.env) +Bundler.require(*Rails.groups(assets: %w(development test))) + module SpecialistFrontend class Application < Rails::Application
Use asset group in development
diff --git a/Latch.podspec b/Latch.podspec index abc1234..def5678 100644 --- a/Latch.podspec +++ b/Latch.podspec @@ -9,6 +9,7 @@ s.social_media_url = "http://twitter.com/endocrimes" s.platform = :ios, "8.0" s.platform = :watchos, "2.0" + s.platform = :osx, "10.9" s.source = { :git => "#{s.homepage}.git", :tag => s.version } s.source_files = "Classes", "Latch/*.{h,swift}" s.framework = "Security"
Add osx support to podfile
diff --git a/yoga_pants.gemspec b/yoga_pants.gemspec index abc1234..def5678 100644 --- a/yoga_pants.gemspec +++ b/yoga_pants.gemspec @@ -3,12 +3,11 @@ Gem::Specification.new do |gem| gem.authors = ["Jack Chen (chendo)"] - gem.email = ["yoga_pants@chen.do"] gem.description = %q{A super lightweight interface to ElasticSearch's HTTP REST API} gem.summary = <<-TEXT.strip A super lightweight interface to ElasticSearch's HTTP REST API. TEXT - gem.homepage = "" + gem.homepage = "https://github.com/chendo/yoga_pants" gem.files = `git ls-files`.split($\) gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
Remove email and add home page
diff --git a/plugins/providers/virtualbox/cap.rb b/plugins/providers/virtualbox/cap.rb index abc1234..def5678 100644 --- a/plugins/providers/virtualbox/cap.rb +++ b/plugins/providers/virtualbox/cap.rb @@ -9,6 +9,8 @@ # # @return [Hash<Integer, Integer>] Host => Guest port mappings. def self.forwarded_ports(machine) + return nil if machine.state.id != :running + {}.tap do |result| machine.provider.driver.read_forwarded_ports.each do |_, _, h, g| result[h] = g
Return nil if the VM is not running when looking at forwarded ports
diff --git a/appledoc22.rb b/appledoc22.rb index abc1234..def5678 100644 --- a/appledoc22.rb +++ b/appledoc22.rb @@ -0,0 +1,37 @@+require 'formula' + +# 2.2 (build 961) introduces support for documenting enumerated and +# bitmask types, and will emit warnings on encountering undocumented +# instances of those types. An archived release is provided as a stable +# dependency for e.g. continuous integration environments. +class Appledoc22 < Formula + homepage 'http://appledoc.gentlebytes.com/' + url "https://github.com/tomaz/appledoc/archive/v2.2.tar.gz" + sha1 '4ad475ee6bdc2e34d6053c4e384aad1781349f5e' + + keg_only %{ +This formula is keg-only to avoid conflicts with the core Appledoc formula. +The executable installed by this formula may be invoked explicitly, +or (if it is the only version installed) linked after it is installed. + } + + depends_on :xcode + depends_on :macos => :lion + + def install + system "xcodebuild", "-project", "appledoc.xcodeproj", + "-target", "appledoc", + "-configuration", "Release", + "clean", "install", + "SYMROOT=build", + "DSTROOT=build", + "INSTALL_PATH=/bin", + "OTHER_CFLAGS='-DCOMPILE_TIME_DEFAULT_TEMPLATE_PATH=@\"#{prefix}/Templates\"'" + bin.install "build/bin/appledoc" + prefix.install "Templates/" + end + + test do + system "#{bin}/appledoc", "--version" + end +end
Add Appledoc 2.2 (build 961). Closes #204. Signed-off-by: Xiyue Deng <4900478725231961caf32165c870e05cea7389d8@gmail.com>
diff --git a/app/controllers/concerns/exception_handler.rb b/app/controllers/concerns/exception_handler.rb index abc1234..def5678 100644 --- a/app/controllers/concerns/exception_handler.rb +++ b/app/controllers/concerns/exception_handler.rb @@ -19,11 +19,11 @@ self.response_body = nil if current_user.nil? - redirect_to new_user_session_path, alert: I18n.t('devise.failure.unauthenticated') + redirect_to main_app.new_user_session_path, alert: I18n.t('devise.failure.unauthenticated') elsif request.env['HTTP_REFERER'] redirect_to :back, alert: I18n.t('controllers.unauthorized') else - redirect_to root_path, alert: I18n.t('controllers.unauthorized') + redirect_to main_app.root_path, alert: I18n.t('controllers.unauthorized') end end
Fix redirect when inside an engine
diff --git a/app/controllers/filtering_tests_controller.rb b/app/controllers/filtering_tests_controller.rb index abc1234..def5678 100644 --- a/app/controllers/filtering_tests_controller.rb +++ b/app/controllers/filtering_tests_controller.rb @@ -3,19 +3,11 @@ def new @filtering_test = @product.product_tests.build({}, FilteringTest) - @filtering_test.tasks << DemographicsTask.new - @filtering_test.tasks << DemographicsTask.new - @filtering_test.tasks << LocationsTask.new end def create @filtering_test = @product.product_tests.build(params[:product_tests], FilteringTest) - tasks = [DemographicsTask, DemographicsTask, LocationsTask] - params[:product_test][:tasks_attributes].each do |_, v| - task_type = tasks.shift - @filtering_test.tasks << task_type.send('new', v) - end - tasks.each { |task| @filtering_test.tasks << task.send('new') } + @filtering_test.name = "C4 #{@product.name}" measure = Measure.top_level.first # TODO: This shouldn't default to first measures, measures need to be stored on the product
Remove references to C4Task subclasses.
diff --git a/app/view_models/group_assignment_repo_view.rb b/app/view_models/group_assignment_repo_view.rb index abc1234..def5678 100644 --- a/app/view_models/group_assignment_repo_view.rb +++ b/app/view_models/group_assignment_repo_view.rb @@ -0,0 +1,38 @@+# frozen_string_literal: true + +class GroupAssignmentRepoView < ViewModel + attr_reader :assignment_repo + + def repo_url + @repo_url ||= github_repo.html_url + end + + def github_repo + assignment_repo.github_repository + end + + def team_members + @team_members ||= assignment_repo.group.repo_accesses.map(&:user) + end + + def team_url + @team_url ||= team.html_url + end + + def team_name + @team_name ||= team.name + end + + def team + assignment_repo.github_team + end + + def number_of_commits + branch = github_repo.default_branch + @number_of_commits ||= github_repo.commits(branch).length + end + + def disabled? + assignment_repo.disabled? + end +end
Create view model for group assignment repo
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,11 +1,9 @@ Rails.application.routes.draw do authenticated :developer do - resources :mailbox, only: :show root 'developers#profile', as: :developer_root end authenticated :employer do - resources :mailbox, only: :show root 'search#index', as: :employer_root end @@ -34,6 +32,7 @@ graphql_path: '/graphql' end + resources :mailbox, only: :show resources :search, only: :index resources :employers, only: [:show, :edit] resources :developers, only: [:edit, :show]
Move mailboxer route out of authenticated scope
diff --git a/JBSSettings.podspec b/JBSSettings.podspec index abc1234..def5678 100644 --- a/JBSSettings.podspec +++ b/JBSSettings.podspec @@ -4,7 +4,7 @@ s.summary = 'A settings object that is less annoying than NSUserDefaults' s.description = 'A settings object that is less annoying than NSUserDefaults.' s.homepage = 'https://github.com/jsumners/JBSSettings' - s.license = { :type => 'MIT', :file => 'LICENSE' } + s.license = { :type => 'MIT' } s.authors = { 'James Sumners' => "james.sumners@gmail.com" } s.source = { :git => 'https://github.com/jsumners/JBSSettings.git',
Kill warning about license file
diff --git a/postrank-uri.gemspec b/postrank-uri.gemspec index abc1234..def5678 100644 --- a/postrank-uri.gemspec +++ b/postrank-uri.gemspec @@ -17,7 +17,7 @@ s.add_dependency "addressable", "~> 2.3.0" s.add_dependency "public_suffix", "~> 1.4.2" - s.add_dependency "nokogiri", "~> 1.6.1" + s.add_dependency "nokogiri", ">= 1.6.1", "< 1.8" s.add_development_dependency "rspec"
Allow newer versions on Nokogiri Tested and working with Nokogiri 1.7.0.1
diff --git a/frecon.gemspec b/frecon.gemspec index abc1234..def5678 100644 --- a/frecon.gemspec +++ b/frecon.gemspec @@ -1,7 +1,9 @@+require "frecon/version" + Gem::Specification.new do |s| s.name = "frecon" s.email = "sammidysam@gmail.com" - s.version = "0.0.0" + s.version = FReCon::VERSION s.summary = "A JSON API for scouting FRC competitions." s.description = "A JSON API for scouting FRC competitions that manages the database for the user."
Use the VERSION constant in the gemspec
diff --git a/core/spec/requests/admin/configuration/image_settings_spec.rb b/core/spec/requests/admin/configuration/image_settings_spec.rb index abc1234..def5678 100644 --- a/core/spec/requests/admin/configuration/image_settings_spec.rb +++ b/core/spec/requests/admin/configuration/image_settings_spec.rb @@ -2,6 +2,10 @@ describe "image settings" do stub_authorization! + + after do + reset_spree_preferences + end before do visit spree.admin_path @@ -13,12 +17,12 @@ it "can update attachment_url" do fill_in "Attachments URL", :with => "foobar" fill_in "Attachments Default URL", :with => "barfoo" - fill_in "Attachments Path", :with => "bfaoro" + fill_in "Attachments Path", :with => "spec/dummy/tmp/bfaoro" click_button "Update" Spree::Config[:attachment_url].should == "foobar" Spree::Config[:attachment_default_url].should == "barfoo" - Spree::Config[:attachment_path].should == "bfaoro" + Spree::Config[:attachment_path].should == "spec/dummy/tmp/bfaoro" end end
Reset preferences after spec to properly teardown test and avoid files being saved where they are not gitignored. Fixes #2467
diff --git a/lib/sass_spec.rb b/lib/sass_spec.rb index abc1234..def5678 100644 --- a/lib/sass_spec.rb +++ b/lib/sass_spec.rb @@ -5,6 +5,7 @@ LANGUAGE_VERSIONS = %w( 3.5 3.6 + 3.7 4.0 ) MIN_LANGUAGE_VERSION = Gem::Version.new(LANGUAGE_VERSIONS.first)
Mark 3.7 as a valid language version
diff --git a/tasks/spec_runner.rake b/tasks/spec_runner.rake index abc1234..def5678 100644 --- a/tasks/spec_runner.rake +++ b/tasks/spec_runner.rake @@ -1,20 +1,57 @@ # frozen_string_literal: true require 'rspec/core' -require 'rspec/core/rake_task' +require 'test_queue' +require 'test_queue/runner/rspec' -RSpec::Core::RakeTask.new(:spec) { |t| t.ruby_opts = '-E UTF-8' } -RSpec::Core::RakeTask.new(:ascii_spec) { |t| t.ruby_opts = '-E ASCII' } +module RuboCop + # Helper for executing a code block with a temporary external encoding. + # This is a bit risky, since strings defined before the block may have a + # different encoding than strings defined inside the block. + class SpecRunner + def initialize(encoding: 'UTF-8') + @previous_encoding = Encoding.default_external + @temporary_encoding = encoding + end + + def with_encoding + Encoding.default_external = @temporary_encoding + yield + ensure + Encoding.default_external = @previous_encoding + end + end +end + +desc 'Run RSpec code examples' +task :spec do + RuboCop::SpecRunner.new.with_encoding do + RSpec::Core::Runner.run(%w[spec]) + end +end + +desc 'Run RSpec code examples with ASCII encoding' +task :ascii_spec do + RuboCop::SpecRunner.new(encoding: 'ASCII').with_encoding do + RSpec::Core::Runner.run(%w[spec]) + end +end namespace :parallel do - desc 'Run RSpec in parallel' + desc 'Run RSpec code examples in parallel' task :spec do - sh('rspec-queue spec/') + RuboCop::SpecRunner.new.with_encoding do + ARGV = %w[spec] + TestQueue::Runner::RSpec.new.execute + end end - desc 'Run RSpec in parallel with ASCII encoding' + desc 'Run RSpec code examples in parallel with ASCII encoding' task :ascii_spec do - sh('RUBYOPT="$RUBYOPT -E ASCII" rspec-queue spec/') + RuboCop::SpecRunner.new(encoding: 'ASCII').with_encoding do + ARGV = %w[spec] + TestQueue::Runner::RSpec.new.execute + end end end
Use plain Ruby to implement RSpec Rake tasks Using `RSpec::Core::RakeTask` and e.g. `sh('rspec-queue spec/')` adds different layers of indirection that make the tasks hard to work with. For example, we used two different ways of declaring the default encoding...
diff --git a/app/controllers/export_controller.rb b/app/controllers/export_controller.rb index abc1234..def5678 100644 --- a/app/controllers/export_controller.rb +++ b/app/controllers/export_controller.rb @@ -2,6 +2,9 @@ ######### Exports class ExportController < ApplicationController + EXPORTABLE_MODELS = [Image, Location, LocationDescription, NameDescription, + Name].freeze + before_action :login_required # Callback (no view) to let reviewers change the export status of an @@ -11,13 +14,12 @@ id = params[:id].to_s type = params[:type].to_s value = params[:value].to_s - model_class = type.camelize.safe_constantize + model_class = EXPORTABLE_MODELS.find { |m| m.name.downcase == type } + if !reviewer? flash_error(:runtime_admin_only.t) redirect_back_or_default("/") - elsif !model_class || - !model_class.respond_to?(:column_names) || - model_class.column_names.exclude?("ok_for_export") + elsif !model_class flash_error(:runtime_invalid.t(type: '"type"', value: type)) redirect_back_or_default("/") elsif !value.match(/^[01]$/) @@ -36,4 +38,4 @@ end end end -end+end
Add RCE update to ExportController
diff --git a/app/controllers/pusher_controller.rb b/app/controllers/pusher_controller.rb index abc1234..def5678 100644 --- a/app/controllers/pusher_controller.rb +++ b/app/controllers/pusher_controller.rb @@ -25,7 +25,8 @@ end def authorize_private_channel - request = Request.find_by(id: params[:request_id]) + channel_postfix = params[:channel_name].sub('private-','').to_i + request = Request.find_by(id: channel_postfix) request.is_party_to?(current_user) end end
Fix implementation of authorize_private_channel method. We do not have a request_id key in the params hash. Instead, I use the name of the channel that the user is trying to subscribe to to find the request.
diff --git a/app/controllers/tracks_controller.rb b/app/controllers/tracks_controller.rb index abc1234..def5678 100644 --- a/app/controllers/tracks_controller.rb +++ b/app/controllers/tracks_controller.rb @@ -6,9 +6,6 @@ uri = URI(url) response = Net::HTTP.get(uri) @tracks = JSON.parse(response) - - # happy_api_call = JSON.parse(Net::HTTP.get(URI("http://api.musicgraph.com/api/v2/track/search?api_key=1aeb0c665ce5e2a00bf34da9ec035877&lyrics_phrase=" + @word))) - # @tracks = happy_api_call end end
Refactor tracks controller; remove comments
diff --git a/graph_store.rb b/graph_store.rb index abc1234..def5678 100644 --- a/graph_store.rb +++ b/graph_store.rb @@ -6,7 +6,7 @@ end get '/' do - "List all graphs" + "List api info/documentation" #TODO: OR list documentation end @@ -16,18 +16,23 @@ end #TODO: add new graph +#after that add nodes and edges post '/new' do - "new" + graph_name = params[:name] + File.write(graph_name, params.to_json) end #TODO: rename existing graph put '/rename' do - "rename" + old_name = params[:old_name] + new_name = params[:new_name] + File.rename(old_name, new_name) end #TODO: delete graph delete '/delete' do - "delete" + graph_name = params[:name] + File.delete(graph_name) end #TODO:search graph
Add basic new, rename, delete graph functionality
diff --git a/lib/cypher/repository.rb b/lib/cypher/repository.rb index abc1234..def5678 100644 --- a/lib/cypher/repository.rb +++ b/lib/cypher/repository.rb @@ -3,7 +3,7 @@ class Repository attr_accessor :data - attr_reader :path + attr_reader :path, :hashed_password def initialize(path, hashed_password) @path = path
Use hashed_password as an attribute
diff --git a/lib/sandbox_formulary.rb b/lib/sandbox_formulary.rb index abc1234..def5678 100644 --- a/lib/sandbox_formulary.rb +++ b/lib/sandbox_formulary.rb @@ -6,7 +6,10 @@ def self.factory(ref) path = nil - repo = Repository.all.detect { |repo| path = repo.find_formula ref } + repo = Repository.all.detect do |repo| + repo.extend RepositoryImport + path = repo.find_formula ref + end original_factory(path.nil? ? ref : File.join(repo.path, path)) end
Fix sandboxed Formulary to use RepositoryImport
diff --git a/lib/tasks/timezones.rake b/lib/tasks/timezones.rake index abc1234..def5678 100644 --- a/lib/tasks/timezones.rake +++ b/lib/tasks/timezones.rake @@ -41,4 +41,11 @@ TimeZones.travel{|tz| ENV['TZ'] = tz if tz; Time.now } end end + + namespace :rails do + desc "move aroud system timezones" + task travel: :environment do + TimeZones.travel{|tz| tz ? Time.now.in_time_zone(tz) : Time.zone.now } + end + end end
Add world travel on Rails
diff --git a/Casks/softorino-youtube-converter.rb b/Casks/softorino-youtube-converter.rb index abc1234..def5678 100644 --- a/Casks/softorino-youtube-converter.rb +++ b/Casks/softorino-youtube-converter.rb @@ -0,0 +1,12 @@+cask 'softorino-youtube-converter' do + version :latest + sha256 :no_check + + # devmate.com is the official download host per the vendor homepage + url 'https://dl.devmate.com/com.softorino.converter/SoftorinoConverter.dmg' + name 'Softorino YouTube Converter' + homepage 'http://softorino.com/youtube-converter' + license :gratis + + app 'Softorino YouTube Converter.app' +end
Add Softorino YouTube Converter.app latest version YouTube. Offline. No Ads. Background Playback. http://softorino.com/youtube-converter
diff --git a/test/test_posixlock.rb b/test/test_posixlock.rb index abc1234..def5678 100644 --- a/test/test_posixlock.rb +++ b/test/test_posixlock.rb @@ -16,6 +16,13 @@ end def test_lockf + pid = 0 + + Signal.trap("USR2") { + assert_equal pid, @file.lockf(File::F_TEST, 0) + Process.kill('USR1', pid) + } + pid = fork { Signal.trap("USR1") { exit } @@ -25,15 +32,18 @@ loop { sleep(1) } } - Signal.trap("USR2") { - assert_equal pid, @file.lockf(File::F_TEST, 0) - Process.kill('USR1', pid) - } - Process.wait end def test_posixlock + pid = 0 + + Signal.trap("USR2") { + assert_equal pid, @file.lockf(File::F_TEST, 0) + Process.kill('USR1', pid) + assert @file.posixlock(File::LOCK_EX) + } + pid = fork { Signal.trap("USR1") { exit } @@ -43,12 +53,6 @@ loop { sleep(1) } } - Signal.trap("USR2") { - assert_equal pid, @file.lockf(File::F_TEST, 0) - Process.kill('USR1', pid) - assert @file.posixlock(File::LOCK_EX) - } - Process.wait end end
Move trap signal on parent before fork in tests
diff --git a/main.rb b/main.rb index abc1234..def5678 100644 --- a/main.rb +++ b/main.rb @@ -1,5 +1,5 @@ get '/' do @recruiters = YAML.load_file('recruiters.yml') - filter = '*@' + [@recruiters['thirdparty'] + @recruiters['companies'] + @recruiters['other']].flatten.join('OR *@') + filter = '*@' + [@recruiters['thirdparty'] + @recruiters['companies'] + @recruiters['other']].flatten.join(' OR *@') erb :index, locals: { recruiters: @recruiters, filter: filter } end
Fix spacing in GMail filter
diff --git a/app/models/supporting_page.rb b/app/models/supporting_page.rb index abc1234..def5678 100644 --- a/app/models/supporting_page.rb +++ b/app/models/supporting_page.rb @@ -2,4 +2,5 @@ include Edition::RelatedPolicies include ::Attachable + validates :related_policies, length: { minimum: 1, message: "must include at least one policy" } end
Validate that supporting page has > 0 policies
diff --git a/hector.gemspec b/hector.gemspec index abc1234..def5678 100644 --- a/hector.gemspec +++ b/hector.gemspec @@ -2,8 +2,8 @@ s.name = "hector" s.version = "1.0.7" s.platform = Gem::Platform::RUBY - s.authors = ["Sam Stephenson"] - s.email = ["sstephenson@gmail.com"] + s.authors = ["Sam Stephenson", "Ross Paffett"] + s.email = ["sstephenson@gmail.com", "ross@rosspaffett.com"] s.homepage = "http://github.com/sstephenson/hector" s.summary = "Private group chat server" s.description = "A private group chat server for people you trust. Implements a limited subset of the IRC protocol."
Add Ross Paffett as a gem author Sam says that I am special now
diff --git a/graph.rb b/graph.rb index abc1234..def5678 100644 --- a/graph.rb +++ b/graph.rb @@ -8,7 +8,7 @@ end def make_edges(graph_info) - graph_info.foreach do |connection| + graph_info.each do |connection| add_edge(connection[0], connection[1], @directed) end end
Change for each to each
diff --git a/inky.gemspec b/inky.gemspec index abc1234..def5678 100644 --- a/inky.gemspec +++ b/inky.gemspec @@ -1,5 +1,5 @@ Gem::Specification.new do |s| - s.name = 'inky' + s.name = 'inky-rb' s.version = '0.0.2' s.date = '2016-02-12' s.summary = 'Inky is an HTML-based templating language that converts simple HTML into complex, responsive email-ready HTML. Designed for Foundation for Emails, a responsive email framework from ZURB. '
Change name to work around naming conflict
diff --git a/spec/element_spec.rb b/spec/element_spec.rb index abc1234..def5678 100644 --- a/spec/element_spec.rb +++ b/spec/element_spec.rb @@ -13,11 +13,13 @@ end context "with text" do - subject do - Element.new(:h1) { self << "Hello World" }.to_s + context "explicit sintax" do + subject do + Element.new(:h1) { self << "Hello World" }.to_s + end + + it { should == "<h1>Hello World</h1>" } end - - it { should == "<h1>Hello World</h1>" } end context "nested element" do
Refactor: Add with text explicit sintax context
diff --git a/spec/mapping_spec.rb b/spec/mapping_spec.rb index abc1234..def5678 100644 --- a/spec/mapping_spec.rb +++ b/spec/mapping_spec.rb @@ -0,0 +1,35 @@+require 'spec_helper' + +describe Mementus::Model do + + describe "Mapping" do + + class Mapping < Mementus::Model + attribute :description, String + attribute :number, Integer + end + + let(:mapping) { + Mapping.new( + :description => "Hello world.", + :number => 2014 + ) + } + + let(:object_id) { + mapping.object_id.to_s + } + + it "maps attribute schema to tuple" do + schema = [[:__object_id, String], [:description, String], [:number, Integer]] + expect(mapping.schema_tuple).to eq schema + end + + it "maps attribute values to tuple" do + values = [object_id, "Hello world.", 2014] + expect(mapping.values_tuple).to eq values + end + + end + +end
Test expected schema and values tuple mapping
diff --git a/core/dir/home_spec.rb b/core/dir/home_spec.rb index abc1234..def5678 100644 --- a/core/dir/home_spec.rb +++ b/core/dir/home_spec.rb @@ -0,0 +1,18 @@+require File.dirname(__FILE__) + '/../../spec_helper' +require File.dirname(__FILE__) + '/fixtures/common' + +ruby_version_is "1.9.2" do + describe "Dir.home" do + it "returns the current user's home directory as a string if called without arguments" do + Dir.home.should == home_directory + end + + it "returns the named user's home directory as a string if called with an argument" do + Dir.home(ENV['USER']).should == home_directory + end + + it "raises an ArgumentError if the named user doesn't exist" do + lambda { Dir.home('geuw2n288dh2k') }.should raise_error(ArgumentError) + end + end +end
Dir.home: Add initial tests for 1.9.2 method.
diff --git a/spec/integration/arel/update_spec.rb b/spec/integration/arel/update_spec.rb index abc1234..def5678 100644 --- a/spec/integration/arel/update_spec.rb +++ b/spec/integration/arel/update_spec.rb @@ -28,5 +28,6 @@ user.age = 21 expect(mapper.update(user, :age)).to be(1) + expect(mapper.first.age).to be(21) end end
Check if an object was actually updated. Dooh.
diff --git a/spec/skimlinks/configuration_spec.rb b/spec/skimlinks/configuration_spec.rb index abc1234..def5678 100644 --- a/spec/skimlinks/configuration_spec.rb +++ b/spec/skimlinks/configuration_spec.rb @@ -8,10 +8,16 @@ describe '.configure' do Skimlinks::Configuration::VALID_CONFIG_KEYS.each do |key| it "should set the #{key}" do + valid_values_const_name = "VALID_#{key.to_s.pluralize.upcase}" + value = if Skimlinks::Configuration.const_defined?(valid_values_const_name) + Skimlinks::Configuration.const_get(valid_values_const_name).sample + else + Faker::Lorem.word + end Skimlinks.configure do |config| - config.send "#{key}=", key + config.send "#{key}=", value end - Skimlinks.configuration.send(key).should eq(key) + Skimlinks.configuration.send(key).should eq(value) end end end
Check for Configuration::VALID_FOOS in spec
diff --git a/spec/unit/cronenberg__config_spec.rb b/spec/unit/cronenberg__config_spec.rb index abc1234..def5678 100644 --- a/spec/unit/cronenberg__config_spec.rb +++ b/spec/unit/cronenberg__config_spec.rb @@ -12,9 +12,26 @@ } end + let(:config_hash_partial) do + { + host: 'vsphere.pizza.com', + user: 'pizzamaster5000', + } + end + context "with no env variables or config file" do it "should raise a RunTime error" do expect{ Cronenberg::Config.new }.to raise_error(RuntimeError) + end + end + + context "with partial env vars or config file" do + before do + allow_any_instance_of(Cronenberg::Config).to receive(:process_environment_variables).and_return(config_hash_partial) + end + + it "should raise a RunTime error listing missing config items" do + expect { Cronenberg::Config.new }.to raise_error(RuntimeError, /missing settings/) end end @@ -31,4 +48,3 @@ end end end -
Test that Cronenberg::Config can list missing config items.
diff --git a/recipes/wordcount.rb b/recipes/wordcount.rb index abc1234..def5678 100644 --- a/recipes/wordcount.rb +++ b/recipes/wordcount.rb @@ -12,9 +12,10 @@ hops_hdfs_directory "#{Chef::Config.file_cache_path}/apache.txt" do - action :put + action :put_as_superuser dest "/user/#{node.flink.user}" owner node.flink.user + group node.flink.group mode "775" end
Create directories in HDFS as superuser, which already belongs to certs group and has the correct permissions to use the certificates
diff --git a/CKRefreshControl.podspec b/CKRefreshControl.podspec index abc1234..def5678 100644 --- a/CKRefreshControl.podspec +++ b/CKRefreshControl.podspec @@ -1,15 +1,15 @@ Pod::Spec.new do |s| s.name = "CKRefreshControl" - s.version = "1.0.0" + s.version = "1.1.0" s.summary = "A pull-to-refresh view for iOS 5, 100% API-compatible with UIRefreshControl in iOS 6." s.homepage = "https://github.com/instructure/CKRefreshControl" s.license = 'MIT' s.author = 'Instructure, Inc.' - s.source = { :git => "https://github.com/instructure/CKRefreshControl.git", :tag => "1.0.0" } + s.source = { :git => "https://github.com/instructure/CKRefreshControl.git", :tag => "1.1.0" } s.platform = :ios, '5.0' s.source_files = 'CKRefreshControl/' s.public_header_files = 'CKRefreshControl/CKRefreshControl.h' s.framework = 'QuartzCore' s.requires_arc = true s.xcconfig = { "OTHER_LDFLAGS" => "-ObjC" } -end+end
Update podspec to the 1.1 version This has actually been on CcooaPods/Specs for months; I just forgot to commit it here too.
diff --git a/ResearchKit.podspec b/ResearchKit.podspec index abc1234..def5678 100644 --- a/ResearchKit.podspec +++ b/ResearchKit.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'ResearchKit' - s.version = '1.3.0' + s.version = '1.3.1' s.summary = 'ResearchKit is an open source software framework that makes it easy to create apps for medical research or for other research projects.' s.homepage = 'https://www.github.com/ResearchKit/ResearchKit' s.documentation_url = 'http://researchkit.github.io/docs/'
Update pod spec version number.
diff --git a/resque-retry.gemspec b/resque-retry.gemspec index abc1234..def5678 100644 --- a/resque-retry.gemspec +++ b/resque-retry.gemspec @@ -8,7 +8,7 @@ s.email = 'luke@lividpenguin.com' s.has_rdoc = false - s.files = %w(LICENSE Rakefile README.md) + s.files = %w(LICENSE Rakefile README.md HISTORY.md) s.files += Dir.glob('{test/*,lib/**/*}') s.require_paths = ['lib']
Include HISTORY.md file in gem. This one should really be tagged v0.0.2 ;-)
diff --git a/test/fibonacci_test.rb b/test/fibonacci_test.rb index abc1234..def5678 100644 --- a/test/fibonacci_test.rb +++ b/test/fibonacci_test.rb @@ -0,0 +1,46 @@+require 'minitest/autorun' +require 'fibonacci' + +class FibonacciTest < MiniTest::Unit::TestCase + def setup + @fib = Fibonacci.new + end + + def test_brackets_method + assert_equal 0, @fib[0] + assert_equal 1, @fib[1] + assert_equal 34, @fib[9] + assert_equal 55, @fib[10] + assert_equal 354224848179261915075, @fib[100] + + assert_raises ArgumentError do + @fib[-1] + end + + assert_raises ArgumentError do + @fib["12"] + end + + assert_raises ArgumentError do + @fib[1.0] + end + end + + def test_terms + assert_equal [0, 1, 1, 2, 3, 5], @fib.terms(6) + assert_equal [], @fib.terms(0) + assert_equal [0], @fib.terms(1) + + assert_raises ArgumentError do + @fib.terms(-1) + end + + assert_raises TypeError do + @fib.terms("12") + end + + assert_raises RangeError do + @fib.terms(100000000000000000000000000000) + end + end +end
Add tests for fib[], fib.terms method
diff --git a/app/controllers/appointment_summaries_controller.rb b/app/controllers/appointment_summaries_controller.rb index abc1234..def5678 100644 --- a/app/controllers/appointment_summaries_controller.rb +++ b/app/controllers/appointment_summaries_controller.rb @@ -6,7 +6,7 @@ end def create - @appointment_summary = AppointmentSummary.create(appointment_summary_params) + @appointment_summary = AppointmentSummary.create(appointment_summary_params.merge(user: current_user)) if @appointment_summary.persisted? IssueOutputDocument.new(@appointment_summary).call else
Set current_user when creating AppointmentSummary
diff --git a/render_async.gemspec b/render_async.gemspec index abc1234..def5678 100644 --- a/render_async.gemspec +++ b/render_async.gemspec @@ -10,7 +10,7 @@ spec.email = ["kawsper@gmail.com"] spec.description = %q{RenderAsync lets you include pages asynchronously with AJAX} spec.summary = %q{RenderAsync lets you include pages asynchronously with AJAX} - spec.homepage = "" + spec.homepage = "https://github.com/kaspergrubbe/render_async" spec.license = "MIT" spec.files = `git ls-files`.split($/)
Add a webpage description to the Gemspec
diff --git a/Casks/bose-soundtouch.rb b/Casks/bose-soundtouch.rb index abc1234..def5678 100644 --- a/Casks/bose-soundtouch.rb +++ b/Casks/bose-soundtouch.rb @@ -0,0 +1,21 @@+cask :v1 => 'bose-soundtouch' do + version '9.0.41.11243' + sha256 '3eb78048bc8aa46b9d2613ff28d760fa7e47133384aca74f44aab4bc10c95f8a' + + url "http://worldwide.bose.com/downloads/assets/updates/soundtouch_app-m/SoundTouch-#{version}-osx-10.9-installer.app.dmg" + name 'Bose Soundtouch Controller App' + homepage 'https://www.soundtouch.com' + license :closed + + depends_on :macos => '>= :mavericks' + + installer :script => 'SoundTouch-osx-installer.app/Contents/MacOS/installbuilder.sh', + :args => %w[--mode unattended], + :sudo => true + + uninstall :script => { + :executable => '/Applications/SoundTouch/uninstall.app/Contents/MacOS/installbuilder.sh', + :args => %w[--mode unattended], + :sudo => true + } +end
Add Bose Soundtouch Controller 9.0.41
diff --git a/Casks/gurps-character-sheet.rb b/Casks/gurps-character-sheet.rb index abc1234..def5678 100644 --- a/Casks/gurps-character-sheet.rb +++ b/Casks/gurps-character-sheet.rb @@ -1,7 +1,9 @@ class GurpsCharacterSheet < Cask - url 'https://downloads.sourceforge.net/project/gcs-java/gcs-4.0.0-mac.zip' + version '4.0.1' + sha256 'ddff9b883b29be7dce0798cfedfe48c54d02a2adb16dc1e60cbcaa37d2ef902e' + + url 'https://downloads.sourceforge.net/project/gcs-java/gcs-4.0.1-mac.zip' homepage 'http://gurpscharactersheet.com' - version '4.0.0' - sha256 '67ccecc44d28f8cf104094ae988779b8219f79a6e6fbe9c695828034d3307816' - link 'gcs-4.0.0-mac/GURPS Character Sheet.app' + + link 'gcs-4.0.1-mac/GURPS Character Sheet.app' end
Update GURPS Character Sheet.app to v1.0.4 GCS updated and the old download link is dead, so the cask needs to be updated to the new version.
diff --git a/app/models/patient.rb b/app/models/patient.rb index abc1234..def5678 100644 --- a/app/models/patient.rb +++ b/app/models/patient.rb @@ -3,7 +3,6 @@ include Mongoid::Timestamps include Mongoid::History::Trackable include Mongoid::Userstamp - include Mongoid::Search # Relationships has_many :pregnancies @@ -33,7 +32,16 @@ mongoid_userstamp user_model: 'User' # Methods + + def self.search(name_or_phone_str) # TODO: optimize - search_in :name, :primary_phone, :secondary_phone + clean_phone = name_or_phone_str.gsub(/\D/, '') + phone = clean_phone[0..2] + '-' + clean_phone[3..5] + '-' + clean_phone[6..10] + begin + name_matches = Patient.where ({name: /^#{Regexp.escape(name_or_phone_str)}$/i}) + primary_matches = Patient.where primary_phone: phone + secondary_matches = Patient.where secondary_phone: phone + (name_matches | primary_matches | secondary_matches) + end end end
Make search case insensitive and phone number format agnostic
diff --git a/Library/Homebrew/test/testing_env.rb b/Library/Homebrew/test/testing_env.rb index abc1234..def5678 100644 --- a/Library/Homebrew/test/testing_env.rb +++ b/Library/Homebrew/test/testing_env.rb @@ -0,0 +1,54 @@+# This software is in the public domain, furnished "as is", without technical +# support, and with no warranty, express or implied, as to its usefulness for +# any purpose. + +# Require this file to build a testing environment. + +ABS__FILE__=File.expand_path(__FILE__) + +$:.push(File.expand_path(__FILE__+'/../..')) +require 'extend/pathname' + +# these are defined in global.rb, but we don't want to break our actual +# homebrew tree, and we do want to test everything :) +HOMEBREW_PREFIX=Pathname.new '/private/tmp/testbrew/prefix' +HOMEBREW_REPOSITORY=HOMEBREW_PREFIX +HOMEBREW_CACHE=HOMEBREW_PREFIX.parent+"cache" +HOMEBREW_CELLAR=HOMEBREW_PREFIX.parent+"cellar" +HOMEBREW_USER_AGENT="Homebrew" +HOMEBREW_WWW='http://example.com' +MACOS_VERSION=10.6 + +(HOMEBREW_PREFIX+'Library/Formula').mkpath +Dir.chdir HOMEBREW_PREFIX +at_exit { HOMEBREW_PREFIX.parent.rmtree } + +# Test fixtures and files can be found relative to this path +TEST_FOLDER = Pathname.new(ABS__FILE__).parent.realpath + + +class ExecutionError <RuntimeError + attr :exit_status + + def initialize cmd, args = [], es = nil + super "Failure while executing: #{cmd} #{pretty(args)*' '}" + @exit_status = es.exitstatus rescue 1 + end + + private + + def pretty args + args.collect do |arg| + if arg.to_s.include? ' ' + "'#{ arg.gsub "'", "\\'" }'" + else + arg + end + end + end +end + +class BuildError <ExecutionError +end + +require 'test/unit' # must be after at_exit
Add new "testing environment" include.
diff --git a/test/integration/templates/gem_layout_test.rb b/test/integration/templates/gem_layout_test.rb index abc1234..def5678 100644 --- a/test/integration/templates/gem_layout_test.rb +++ b/test/integration/templates/gem_layout_test.rb @@ -0,0 +1,34 @@+require "integration_test_helper" + +class GemLayoutTest < ActionDispatch::IntegrationTest + setup do + Capybara.current_driver = Capybara.javascript_driver + visit "/templates/gem_layout.html.erb" + end + + should "allow user to report a problem with the page" do + click_on "Report a problem with this page" + assert page.has_content?("Help us improve GOV.UK") + assert page.has_field?("What went wrong?") + + # Regression test for scenario where wrong URL is set + url_input = page.find("form[action='/contact/govuk/problem_reports'] input[name=url]", visible: false) + assert_equal page.current_url, url_input.value + end + + should "allow user to report that the page is not useful" do + click_on "No" # No, this page is not useful + assert page.has_content?("Help us improve GOV.UK") + assert page.has_field?("Email address") + + # Regression test for scenario where wrong URL is set + url_input = page.find("form[action='/contact/govuk/email-survey-signup'] input[name='email_survey_signup[survey_source]']", visible: false) + full_path = URI(page.current_url).request_uri + assert_equal full_path, url_input.value + end + + should "allow user to report that the page is useful" do + click_on "Yes" # Yes, this page is useful + assert page.has_content?("Thank you for your feedback") + end +end
Test that gem_layout renders feedback component This imports a test from Smokey [^1][^2] that confirms that the feedback component is present & functional. The Smokey test does not currently meet the eligibility criteria for inclusion in the repository [^3], but by adding this test to Static we can meet the "Second critical functional check" criterion. [^1]: https://github.com/alphagov/smokey/blob/main/features/apps/static.feature [^2]: https://github.com/alphagov/smokey/blob/main/features/step_definitions/feedback_steps.rb [^3]: https://github.com/alphagov/smokey/blob/main/docs/writing-tests.md
diff --git a/aruba-doubles.gemspec b/aruba-doubles.gemspec index abc1234..def5678 100644 --- a/aruba-doubles.gemspec +++ b/aruba-doubles.gemspec @@ -2,10 +2,10 @@ Gem::Specification.new do |s| s.name = 'aruba-doubles' - s.version = '0.0.1' + s.version = '0.0.2' s.authors = ["Björn Albers"] s.email = ["bjoernalbers@googlemail.com"] - s.description = 'Double command line applications in your Cucumber features' + s.description = 'Stub command line applications with Cucumber' s.summary = "#{s.name}-#{s.version}" s.homepage = 'https://github.com/bjoernalbers/aruba-doubles'
Update gemspec description and bump minor version
diff --git a/app/controllers/user/accounts_controller.rb b/app/controllers/user/accounts_controller.rb index abc1234..def5678 100644 --- a/app/controllers/user/accounts_controller.rb +++ b/app/controllers/user/accounts_controller.rb @@ -1,4 +1,6 @@ class User::AccountsController < ApplicationController + + skip_authorization_check, only: :switch_circle before_action :ensure_logged_in before_action :ensure_circle
Fix skip_authorization_check gone missing for switch_circle.
diff --git a/rufus-scheduler.gemspec b/rufus-scheduler.gemspec index abc1234..def5678 100644 --- a/rufus-scheduler.gemspec +++ b/rufus-scheduler.gemspec @@ -30,7 +30,7 @@ s.required_ruby_version = '>= 1.9' - s.add_runtime_dependency 'fugit', '~> 1.1', '>= 1.1.1' + s.add_runtime_dependency 'fugit', '~> 1.1', '>= 1.1.4' s.add_development_dependency 'rspec', '~> 3.7' s.add_development_dependency 'chronic', '~> 0.10'
Upgrade fugit to 1.1.4 (thus et-orbi To 1.1.2)
diff --git a/spec/togglr/toggles_with_active_record_spec.rb b/spec/togglr/toggles_with_active_record_spec.rb index abc1234..def5678 100644 --- a/spec/togglr/toggles_with_active_record_spec.rb +++ b/spec/togglr/toggles_with_active_record_spec.rb @@ -52,6 +52,7 @@ context 'value in the database' do it 'returns the value from the database' do + expect(Togglr::Toggles.true_toggle?).to be_true Togglr::Toggles.true_toggle = false expect(Togglr::Toggles.true_toggle?).to be_false end
Expand test to show prior data
diff --git a/TodUni/db/migrate/20160531201359_add_attributes_to_projects.rb b/TodUni/db/migrate/20160531201359_add_attributes_to_projects.rb index abc1234..def5678 100644 --- a/TodUni/db/migrate/20160531201359_add_attributes_to_projects.rb +++ b/TodUni/db/migrate/20160531201359_add_attributes_to_projects.rb @@ -0,0 +1,7 @@+class AddAttributesToProjects < ActiveRecord::Migration + def change + rename_column :projects, :due_date, :date_end + add_column :projects, :date_beginning, :string + add_column :projects, :budget, :string + end +end
Add date_beginning & budget, rename due_date to date_end in projects table migration
diff --git a/lib/dm-tags/tagging.rb b/lib/dm-tags/tagging.rb index abc1234..def5678 100644 --- a/lib/dm-tags/tagging.rb +++ b/lib/dm-tags/tagging.rb @@ -2,7 +2,7 @@ include DataMapper::Resource property :id, Serial - property :taggable_id, Integer, :required => true + property :taggable_id, Integer, :required => true, :min => 1 property :taggable_type, Class, :required => true property :tag_context, String, :required => true
[dm-tags] Support dm-constraints in explicitly defined FK
diff --git a/lib/vcloud/rest_api.rb b/lib/vcloud/rest_api.rb index abc1234..def5678 100644 --- a/lib/vcloud/rest_api.rb +++ b/lib/vcloud/rest_api.rb @@ -31,7 +31,7 @@ :payload => payload, :verify_ssl => false, :headers => session.token.merge({ - :accept => VCloud::Constants::ACCEPT_HEADER+';version=#{@api_version}', + :accept => VCloud::Constants::ACCEPT_HEADER+";version=#{session.api_version}", :content_type => content_type}) ) puts request.inspect
Fix to include the indicated vcloud api version
diff --git a/app/controllers/expensesheets_controller.rb b/app/controllers/expensesheets_controller.rb index abc1234..def5678 100644 --- a/app/controllers/expensesheets_controller.rb +++ b/app/controllers/expensesheets_controller.rb @@ -1,10 +1,13 @@ class ExpensesheetsController < ApplicationController - before_action :find_user, only: [:new, :create] + before_action :find_user, only: [:new, :create, :show] def new @expenses = Expense.new end + def show + @expenses = @user.expenses.all + end def create Expense.expense_sheet(params[:expense][:amount]).each do |e|
Add show method to expensesheets