How to use runnables method of Reportable Package

Best Minitest_ruby code snippet using Reportable.runnables

minitest.rb

Source:minitest.rb Github

copy

Full Screen

...80 #81 # Minitest.autorun82 # Minitest.run(args)83 # Minitest.__run(reporter, options)84 # Runnable.runnables.each85 # runnable.run(reporter, options)86 # self.runnable_methods.each87 # self.run_one_method(self, runnable_method, reporter)88 # Minitest.run_one_method(klass, runnable_method)89 # klass.new(runnable_method).run90 def self.run args = []91 self.load_plugins unless args.delete("--no-plugins") || ENV["MT_NO_PLUGINS"]92 options = process_args args93 reporter = CompositeReporter.new94 reporter << SummaryReporter.new(options[:io], options)95 reporter << ProgressReporter.new(options[:io], options)96 self.reporter = reporter # this makes it available to plugins97 self.init_plugins options98 self.reporter = nil # runnables shouldn't depend on the reporter, ever99 self.parallel_executor.start if parallel_executor.respond_to?(:start)100 reporter.start101 begin102 __run reporter, options103 rescue Interrupt104 warn "Interrupted. Exiting..."105 end106 self.parallel_executor.shutdown107 reporter.report108 reporter.passed?109 end110 ##111 # Internal run method. Responsible for telling all Runnable112 # sub-classes to run.113 def self.__run reporter, options114 suites = Runnable.runnables.reject { |s| s.runnable_methods.empty? }.shuffle115 parallel, serial = suites.partition { |s| s.test_order == :parallel }116 # If we run the parallel tests before the serial tests, the parallel tests117 # could run in parallel with the serial tests. This would be bad because118 # the serial tests won't lock around Reporter#record. Run the serial tests119 # first, so that after they complete, the parallel tests will lock when120 # recording results.121 serial.map { |suite| suite.run reporter, options } +122 parallel.map { |suite| suite.run reporter, options }123 end124 def self.process_args args = [] # :nodoc:125 options = {126 :io => $stdout,127 }128 orig_args = args.dup129 OptionParser.new do |opts|130 opts.banner = "minitest options:"131 opts.version = Minitest::VERSION132 opts.on "-h", "--help", "Display this help." do133 puts opts134 exit135 end136 opts.on "--no-plugins", "Bypass minitest plugin auto-loading (or set $MT_NO_PLUGINS)."137 desc = "Sets random seed. Also via env. Eg: SEED=n rake"138 opts.on "-s", "--seed SEED", Integer, desc do |m|139 options[:seed] = m.to_i140 end141 opts.on "-v", "--verbose", "Verbose. Show progress processing files." do142 options[:verbose] = true143 end144 opts.on "-n", "--name PATTERN", "Filter run on /regexp/ or string." do |a|145 options[:filter] = a146 end147 opts.on "-e", "--exclude PATTERN", "Exclude /regexp/ or string from run." do |a|148 options[:exclude] = a149 end150 unless extensions.empty?151 opts.separator ""152 opts.separator "Known extensions: #{extensions.join(", ")}"153 extensions.each do |meth|154 msg = "plugin_#{meth}_options"155 send msg, opts, options if self.respond_to?(msg)156 end157 end158 begin159 opts.parse! args160 rescue OptionParser::InvalidOption => e161 puts162 puts e163 puts164 puts opts165 exit 1166 end167 orig_args -= args168 end169 unless options[:seed] then170 srand171 options[:seed] = (ENV["SEED"] || srand).to_i % 0xFFFF172 orig_args << "--seed" << options[:seed].to_s173 end174 srand options[:seed]175 options[:args] = orig_args.map { |s|176 s =~ /[\s|&<>$()]/ ? s.inspect : s177 }.join " "178 options179 end180 def self.filter_backtrace bt # :nodoc:181 backtrace_filter.filter bt182 end183 ##184 # Represents anything "runnable", like Test, Spec, Benchmark, or185 # whatever you can dream up.186 #187 # Subclasses of this are automatically registered and available in188 # Runnable.runnables.189 class Runnable190 ##191 # Number of assertions executed in this run.192 attr_accessor :assertions193 ##194 # An assertion raised during the run, if any.195 attr_accessor :failures196 ##197 # The time it took to run.198 attr_accessor :time199 def time_it # :nodoc:200 t0 = Minitest.clock_time201 yield202 ensure203 self.time = Minitest.clock_time - t0204 end205 ##206 # Name of the run.207 def name208 @NAME209 end210 ##211 # Set the name of the run.212 def name= o213 @NAME = o214 end215 ##216 # Returns all instance methods matching the pattern +re+.217 def self.methods_matching re218 public_instance_methods(true).grep(re).map(&:to_s)219 end220 def self.reset # :nodoc:221 @@runnables = []222 end223 reset224 ##225 # Responsible for running all runnable methods in a given class,226 # each in its own instance. Each instance is passed to the227 # reporter to record.228 def self.run reporter, options = {}229 filter = options[:filter] || "/./"230 filter = Regexp.new $1 if filter =~ %r%/(.*)/%231 filtered_methods = self.runnable_methods.find_all { |m|232 filter === m || filter === "#{self}##{m}"233 }234 exclude = options[:exclude]235 exclude = Regexp.new $1 if exclude =~ %r%/(.*)/%236 filtered_methods.delete_if { |m|237 exclude === m || exclude === "#{self}##{m}"238 }239 return if filtered_methods.empty?240 with_info_handler reporter do241 filtered_methods.each do |method_name|242 run_one_method self, method_name, reporter243 end244 end245 end246 ##247 # Runs a single method and has the reporter record the result.248 # This was considered internal API but is factored out of run so249 # that subclasses can specialize the running of an individual250 # test. See Minitest::ParallelTest::ClassMethods for an example.251 def self.run_one_method klass, method_name, reporter252 reporter.prerecord klass, method_name253 reporter.record Minitest.run_one_method(klass, method_name)254 end255 def self.with_info_handler reporter, &block # :nodoc:256 handler = lambda do257 unless reporter.passed? then258 warn "Current results:"259 warn ""260 warn reporter.reporters.first261 warn ""262 end263 end264 on_signal ::Minitest.info_signal, handler, &block265 end266 SIGNALS = Signal.list # :nodoc:267 def self.on_signal name, action # :nodoc:268 supported = SIGNALS[name]269 old_trap = trap name do270 old_trap.call if old_trap.respond_to? :call271 action.call272 end if supported273 yield274 ensure275 trap name, old_trap if supported276 end277 ##278 # Each subclass of Runnable is responsible for overriding this279 # method to return all runnable methods. See #methods_matching.280 def self.runnable_methods281 raise NotImplementedError, "subclass responsibility"282 end283 ##284 # Returns all subclasses of Runnable.285 def self.runnables286 @@runnables287 end288 @@marshal_dump_warned = false289 def marshal_dump # :nodoc:290 unless @@marshal_dump_warned then291 warn ["Minitest::Runnable#marshal_dump is deprecated.",292 "You might be violating internals. From", caller.first].join " "293 @@marshal_dump_warned = true294 end295 [self.name, self.failures, self.assertions, self.time]296 end297 def marshal_load ary # :nodoc:298 self.name, self.failures, self.assertions, self.time = ary299 end300 def failure # :nodoc:301 self.failures.first302 end303 def initialize name # :nodoc:304 self.name = name305 self.failures = []306 self.assertions = 0307 end308 ##309 # Runs a single method. Needs to return self.310 def run311 raise NotImplementedError, "subclass responsibility"312 end313 ##314 # Did this run pass?315 #316 # Note: skipped runs are not considered passing, but they don't317 # cause the process to exit non-zero.318 def passed?319 raise NotImplementedError, "subclass responsibility"320 end321 ##322 # Returns a single character string to print based on the result323 # of the run. Eg ".", "F", or "E".324 def result_code325 raise NotImplementedError, "subclass responsibility"326 end327 ##328 # Was this run skipped? See #passed? for more information.329 def skipped?330 raise NotImplementedError, "subclass responsibility"331 end332 end333 ##334 # Shared code for anything that can get passed to a Reporter. See335 # Minitest::Test & Minitest::Result.336 module Reportable337 ##338 # Did this run pass?339 #340 # Note: skipped runs are not considered passing, but they don't341 # cause the process to exit non-zero.342 def passed?343 not self.failure344 end345 ##346 # The location identifier of this test. Depends on a method347 # existing called class_name.348 def location349 loc = " [#{self.failure.location}]" unless passed? or error?350 "#{self.class_name}##{self.name}#{loc}"351 end352 def class_name # :nodoc:353 raise NotImplementedError, "subclass responsibility"354 end355 ##356 # Returns ".", "F", or "E" based on the result of the run.357 def result_code358 self.failure and self.failure.result_code or "."359 end360 ##361 # Was this run skipped?362 def skipped?363 self.failure and Skip === self.failure364 end365 ##366 # Did this run error?367 def error?368 self.failures.any? { |f| UnexpectedError === f }369 end370 end371 ##372 # This represents a test result in a clean way that can be373 # marshalled over a wire. Tests can do anything they want to the374 # test instance and can create conditions that cause Marshal.dump to375 # blow up. By using Result.from(a_test) you can be reasonably sure376 # that the test result can be marshalled.377 class Result < Runnable378 include Minitest::Reportable379 undef_method :marshal_dump380 undef_method :marshal_load381 ##382 # The class name of the test result.383 attr_accessor :klass384 ##385 # The location of the test method.386 attr_accessor :source_location387 ##388 # Create a new test result from a Runnable instance.389 def self.from runnable390 o = runnable391 r = self.new o.name392 r.klass = o.class.name393 r.assertions = o.assertions394 r.failures = o.failures.dup395 r.time = o.time396 r.source_location = o.method(o.name).source_location rescue ["unknown", -1]397 r398 end399 def class_name # :nodoc:400 self.klass # for Minitest::Reportable401 end402 def to_s # :nodoc:403 return location if passed? and not skipped?404 failures.map { |failure|405 "#{failure.result_label}:\n#{self.location}:\n#{failure.message}\n"406 }.join "\n"407 end408 end409 ##410 # Defines the API for Reporters. Subclass this and override whatever411 # you want. Go nuts.412 class AbstractReporter413 include Mutex_m414 ##415 # Starts reporting on the run.416 def start417 end418 ##419 # About to start running a test. This allows a reporter to show420 # that it is starting or that we are in the middle of a test run.421 def prerecord klass, name422 end423 ##424 # Record a result and output the Runnable#result_code. Stores the425 # result of the run if the run did not pass.426 def record result427 end428 ##429 # Outputs the summary of the run.430 def report431 end432 ##433 # Did this run pass?434 def passed?435 true436 end437 end438 class Reporter < AbstractReporter # :nodoc:439 ##440 # The IO used to report.441 attr_accessor :io442 ##443 # Command-line options for this run.444 attr_accessor :options445 def initialize io = $stdout, options = {} # :nodoc:446 super()447 self.io = io448 self.options = options449 end450 end451 ##452 # A very simple reporter that prints the "dots" during the run.453 #454 # This is added to the top-level CompositeReporter at the start of455 # the run. If you want to change the output of minitest via a456 # plugin, pull this out of the composite and replace it with your457 # own.458 class ProgressReporter < Reporter459 def prerecord klass, name #:nodoc:460 if options[:verbose] then461 io.print "%s#%s = " % [klass.name, name]462 io.flush463 end464 end465 def record result # :nodoc:466 io.print "%.2f s = " % [result.time] if options[:verbose]467 io.print result.result_code468 io.puts if options[:verbose]469 end470 end471 ##472 # A reporter that gathers statistics about a test run. Does not do473 # any IO because meant to be used as a parent class for a reporter474 # that does.475 #476 # If you want to create an entirely different type of output (eg,477 # CI, HTML, etc), this is the place to start.478 class StatisticsReporter < Reporter479 # :stopdoc:480 attr_accessor :assertions481 attr_accessor :count482 attr_accessor :results483 attr_accessor :start_time484 attr_accessor :total_time485 attr_accessor :failures486 attr_accessor :errors487 attr_accessor :skips488 # :startdoc:489 def initialize io = $stdout, options = {} # :nodoc:490 super491 self.assertions = 0492 self.count = 0493 self.results = []494 self.start_time = nil495 self.total_time = nil496 self.failures = nil497 self.errors = nil498 self.skips = nil499 end500 def passed? # :nodoc:501 results.all?(&:skipped?)502 end503 def start # :nodoc:504 self.start_time = Minitest.clock_time505 end506 def record result # :nodoc:507 self.count += 1508 self.assertions += result.assertions509 results << result if not result.passed? or result.skipped?510 end511 def report # :nodoc:512 aggregate = results.group_by { |r| r.failure.class }513 aggregate.default = [] # dumb. group_by should provide this514 self.total_time = Minitest.clock_time - start_time515 self.failures = aggregate[Assertion].size516 self.errors = aggregate[UnexpectedError].size517 self.skips = aggregate[Skip].size518 end519 end520 ##521 # A reporter that prints the header, summary, and failure details at522 # the end of the run.523 #524 # This is added to the top-level CompositeReporter at the start of525 # the run. If you want to change the output of minitest via a526 # plugin, pull this out of the composite and replace it with your527 # own.528 class SummaryReporter < StatisticsReporter529 # :stopdoc:530 attr_accessor :sync531 attr_accessor :old_sync532 # :startdoc:533 def start # :nodoc:534 super535 io.puts "Run options: #{options[:args]}"536 io.puts537 io.puts "# Running:"538 io.puts539 self.sync = io.respond_to? :"sync=" # stupid emacs540 self.old_sync, io.sync = io.sync, true if self.sync541 end542 def report # :nodoc:543 super544 io.sync = self.old_sync545 io.puts unless options[:verbose] # finish the dots546 io.puts547 io.puts statistics548 aggregated_results io549 io.puts summary550 end551 def statistics # :nodoc:552 "Finished in %.6fs, %.4f runs/s, %.4f assertions/s." %553 [total_time, count / total_time, assertions / total_time]554 end555 def aggregated_results io # :nodoc:556 filtered_results = results.dup557 filtered_results.reject!(&:skipped?) unless options[:verbose]558 filtered_results.each_with_index { |result, i|559 io.puts "\n%3d) %s" % [i+1, result]560 }561 io.puts562 io563 end564 def to_s # :nodoc:565 aggregated_results(StringIO.new(binary_string)).string566 end567 def summary # :nodoc:568 extra = ""569 extra = "\n\nYou have skipped tests. Run with --verbose for details." if570 results.any?(&:skipped?) unless options[:verbose] or ENV["MT_NO_SKIP_MSG"]571 "%d runs, %d assertions, %d failures, %d errors, %d skips%s" %572 [count, assertions, failures, errors, skips, extra]573 end574 private575 if '<3'.respond_to? :b576 def binary_string; ''.b; end577 else578 def binary_string; ''.force_encoding(Encoding::ASCII_8BIT); end579 end580 end581 ##582 # Dispatch to multiple reporters as one.583 class CompositeReporter < AbstractReporter584 ##585 # The list of reporters to dispatch to.586 attr_accessor :reporters587 def initialize *reporters # :nodoc:588 super()589 self.reporters = reporters590 end591 def io # :nodoc:592 reporters.first.io593 end594 ##595 # Add another reporter to the mix.596 def << reporter597 self.reporters << reporter598 end599 def passed? # :nodoc:600 self.reporters.all?(&:passed?)601 end602 def start # :nodoc:603 self.reporters.each(&:start)604 end605 def prerecord klass, name # :nodoc:606 self.reporters.each do |reporter|607 # TODO: remove conditional for minitest 6608 reporter.prerecord klass, name if reporter.respond_to? :prerecord609 end610 end611 def record result # :nodoc:612 self.reporters.each do |reporter|613 reporter.record result614 end615 end616 def report # :nodoc:617 self.reporters.each(&:report)618 end619 end620 ##621 # Represents run failures.622 class Assertion < Exception623 def error # :nodoc:624 self625 end626 ##627 # Where was this run before an assertion was raised?628 def location629 last_before_assertion = ""630 self.backtrace.reverse_each do |s|631 break if s =~ /in .(assert|refute|flunk|pass|fail|raise|must|wont)/632 last_before_assertion = s633 end634 last_before_assertion.sub(/:in .*$/, "")635 end636 def result_code # :nodoc:637 result_label[0, 1]638 end639 def result_label # :nodoc:640 "Failure"641 end642 end643 ##644 # Assertion raised when skipping a run.645 class Skip < Assertion646 def result_label # :nodoc:647 "Skipped"648 end649 end650 ##651 # Assertion wrapping an unexpected error that was raised during a run.652 class UnexpectedError < Assertion653 attr_accessor :exception # :nodoc:654 def initialize exception # :nodoc:655 super "Unexpected exception"656 self.exception = exception657 end658 def backtrace # :nodoc:659 self.exception.backtrace660 end661 def error # :nodoc:662 self.exception663 end664 def message # :nodoc:665 bt = Minitest.filter_backtrace(self.backtrace).join "\n "666 "#{self.exception.class}: #{self.exception.message}\n #{bt}"667 end668 def result_label # :nodoc:669 "Error"670 end671 end672 ##673 # Provides a simple set of guards that you can use in your tests674 # to skip execution if it is not applicable. These methods are675 # mixed into Test as both instance and class methods so you676 # can use them inside or outside of the test methods.677 #678 # def test_something_for_mri679 # skip "bug 1234" if jruby?680 # # ...681 # end682 #683 # if windows? then684 # # ... lots of test methods ...685 # end686 module Guard687 ##688 # Is this running on jruby?689 def jruby? platform = RUBY_PLATFORM690 "java" == platform691 end692 ##693 # Is this running on maglev?694 def maglev? platform = defined?(RUBY_ENGINE) && RUBY_ENGINE695 "maglev" == platform696 end697 ##698 # Is this running on mri?699 def mri? platform = RUBY_DESCRIPTION700 /^ruby/ =~ platform701 end702 ##703 # Is this running on rubinius?704 def rubinius? platform = defined?(RUBY_ENGINE) && RUBY_ENGINE705 "rbx" == platform706 end707 ##708 # Is this running on windows?709 def windows? platform = RUBY_PLATFORM710 /mswin|mingw/ =~ platform711 end712 end713 ##714 # The standard backtrace filter for minitest.715 #716 # See Minitest.backtrace_filter=.717 class BacktraceFilter718 MT_RE = %r%lib/minitest% #:nodoc:719 ##720 # Filter +bt+ to something useful. Returns the whole thing if $DEBUG.721 def filter bt722 return ["No backtrace"] unless bt723 return bt.dup if $DEBUG724 new_bt = bt.take_while { |line| line !~ MT_RE }725 new_bt = bt.select { |line| line !~ MT_RE } if new_bt.empty?726 new_bt = bt.dup if new_bt.empty?727 new_bt728 end729 end730 self.backtrace_filter = BacktraceFilter.new731 def self.run_one_method klass, method_name # :nodoc:732 result = klass.new(method_name).run733 raise "#{klass}#run _must_ return a Result" unless Result === result734 result735 end736 # :stopdoc:737 if defined? Process::CLOCK_MONOTONIC # :nodoc:738 def self.clock_time739 Process.clock_gettime Process::CLOCK_MONOTONIC740 end741 else742 def self.clock_time743 Time.now744 end745 end746 class Runnable # re-open747 def self.inherited klass # :nodoc:748 self.runnables << klass749 super750 end751 end752 # :startdoc:753end754require "minitest/test"...

Full Screen

Full Screen

detail.rb

Source:detail.rb Github

copy

Full Screen

1class Reports::Detail < Reports::Excel2 def initialize(opts = {})3 super(opts)4 @runnables = opts[:runnables] || ExternalActivity.published5 @report_learners = opts[:report_learners] || report_learners_for_runnables(@runnables)6 @url_helpers = opts[:url_helpers]7 @hide_names = opts[:hide_names] || false8 # stud.id, class, school, user.id, username, student name, teachers, completed, %completed, last_run9 @common_columns = common_header(@hide_names) + [10 Reports::ColumnDefinition.new(:title => "# Completed", :width => 10, :left_border => :thin),11 Reports::ColumnDefinition.new(:title => "% Completed", :width => 10),12 Reports::ColumnDefinition.new(:title => "# Correct", :width => 10),13 Reports::ColumnDefinition.new(:title => "Last run", :width => 20),14 Reports::ColumnDefinition.new(:title => "Remote Endpoint", :width => 100)15 ]16 @reportable_embeddables = {} # keys will be runnables, and value will be an array of reportables for that runnable, in the correct order17 end18 def sorted_learners()19 @report_learners.sort_by {|l| [l.school_name, l.class_name, l.student_name, l.runnable_name]}20 end21 def setup_sheet_for_runnable(runnable, idx)22 # Spreadsheet was dying on ":" and "/" chars. Others?23 sheet_name = runnable.name.gsub /[^a-zA-z0-9 ]/,"_"24 # Add index number, as Spreadsheet is failing when two sheets have the same name.25 sheet_name = "#{idx + 1}. #{sheet_name[0..30]}"26 sheet_name "#{idx + 1}. Unknown" unless sheet_name && sheet_name.size > 027 @runnable_sheet[runnable] = @book.create_worksheet :name => sheet_name28 sheet_defs = @common_columns.clone29 answer_defs = []30 header_defs = [] # top level header31 expected_answers = []32 # save the original assignable so we can refer to it later33 assignable = runnable34 if runnable.is_a?(::ExternalActivity)35 if runnable.template36 runnable = runnable.template37 else38 # we can't report on external activities that don't have templates39 return40 end41 end42 # This needs to account for varying types of runnables...43 containers = get_containers(runnable)44 # offset the reportables counter by 245 reportable_header_counter = sheet_defs.size46 header_defs << Reports::ColumnDefinition.new(:title => sheet_name, :heading_row => 0, :col_index => reportable_header_counter)47 containers.each do |a|48 header_defs << Reports::ColumnDefinition.new(:title => a.name, :width=> 30, :heading_row => 0, :col_index => reportable_header_counter)49 reportable_header_counter += 2 # (two columns per container header)50 end51 reportable_header_counter -= 152 # Iterate containers53 containers.each do |a|54 sheet_defs << Reports::ColumnDefinition.new(:title => "#{a.name}\nAssessments Completed", :width => 4, :left_border => :thin)55 sheet_defs << Reports::ColumnDefinition.new(:title => "% Completed", :width => 4)56 reportable_header_counter = setup_sheet_runnables(a, reportable_header_counter, header_defs, answer_defs, expected_answers)57 end #containers58 col_defs = sheet_defs + answer_defs + header_defs59 write_sheet_headers(@runnable_sheet[assignable], col_defs)60 # Add row with expected answers.61 expected_answers.map! { |a| a.nil? ? "" : a }62 row = @runnable_sheet[assignable].row(@runnable_sheet[assignable].last_row_index + 1)63 row.concat(expected_answers)64 end65 def setup_sheet_runnables(container, reportable_header_counter, header_defs, answer_defs, expected_answers)66 reportables = container.reportable_elements.map {|re| re[:embeddable]}67 first = true68 question_counter = 069 # Iterate Reportables70 reportables.each do |r|71 question_counter += 172 reportable_header_counter += 173 header_defs << Reports::ColumnDefinition.new(:title => container.name, :heading_row => 0, :col_index => reportable_header_counter)74 title = clean_text((r.respond_to?(:prompt) ? r.prompt : r.name))75 title = "#{question_counter}: #{title}"76 answer_defs << Reports::ColumnDefinition.new(:title => title, :width => 25, :left_border => (first ? :thin : :none))77 expected_answers[reportable_header_counter] = get_expected_answer(r)78 if r.is_a?(Embeddable::ImageQuestion)79 reportable_header_counter += 180 answer_defs << Reports::ColumnDefinition.new(:title => 'note', :width => 25, :left_border => :none)81 end82 if r.is_required?83 reportable_header_counter += 184 answer_defs << Reports::ColumnDefinition.new(:title => 'submitted', :width => 10, :left_border => :none)85 end86 first = false87 end # reportables88 return reportable_header_counter89 end90 def run_report91 @book = Reports::Book.new(verbose: @verbose)92 @runnable_sheet = {}93 @runnables = @runnables.to_a94 @runnables.sort!{|a,b| a.name <=> b.name}95 print "Creating #{@runnables.size} worksheets for report" if @verbose96 @runnables.each_with_index do |runnable, idx|97 setup_sheet_for_runnable(runnable, idx)98 end # runnables99 puts " done." if @verbose100 student_learners = sorted_learners.group_by {|l| [l.student_id,l.class_id] }101 print "Filling in student data" if @verbose102 iterate_with_status(student_learners.keys) do |student_class|103 student_id = student_class[0]104 student_learners[student_class].each do |l|105 next unless (runnable = @runnables.detect{|r| l.runnable_type == r.class.to_s && r.id == l.runnable_id})106 # sheets are indexed from the actual runnable107 sheet = @runnable_sheet[runnable]108 if runnable.is_a?(::ExternalActivity)109 if runnable.template110 runnable = runnable.template111 else112 # we can't report on external activities that don't have templates113 next114 end115 end116 correctable = runnable.reportable_elements.select {|r| r[:embeddable].respond_to? :correctable? }117 # <=================================================>118 total_assessments = l.num_answerables119 assess_completed = l.num_submitted...

Full Screen

Full Screen

detail_spec.rb

Source:detail_spec.rb Github

copy

Full Screen

...20 expect(result).not_to be_nil21 end22 end23 # TODO: auto-generated24 describe '#setup_sheet_runnables' do25 xit 'setup_sheet_runnables' do26 opts = {}27 detail = described_class.new(opts)28 container = double('container')29 reportable_header_counter = double('reportable_header_counter')30 header_defs = double('header_defs')31 answer_defs = double('answer_defs')32 expected_answers = double('expected_answers')33 result = detail.setup_sheet_runnables(container, reportable_header_counter, header_defs, answer_defs, expected_answers)34 expect(result).not_to be_nil35 end36 end37 # TODO: auto-generated38 describe '#run_report' do39 it 'run_report' do40 opts = {}41 detail = described_class.new(opts)42 result = detail.run_report43 expect(result).not_to be_nil44 end45 end46 # TODO: auto-generated47 describe '#default_answer_for' do...

Full Screen

Full Screen

runnables

Using AI Code Generation

copy

Full Screen

1 def self.included(base)2B.included_modules.include?(A)3B.include?(A)4 def self.prepended(base)5B.prepend?(A)6 def self.extended(base)7B.extended?(A)

Full Screen

Full Screen

runnables

Using AI Code Generation

copy

Full Screen

1 def self.included(base)2B.included_modules.include?(A)3B.include?(A)4 def self.prepended(base)5B.prepend?(A)6 def self.extended(base)7B.extended?(A)

Full Screen

Full Screen

runnables

Using AI Code Generation

copy

Full Screen

1 def initialize(name, age)2 def initialize(name, age)3people << Person.new('Bob', 30)4people << Person.new('Sue', 25)5people << Person.new('Joe', 45)6dogs << Dog.new('Fido', 3)7dogs << Dog.new('Rover', 4)8dogs << Dog.new('Spot', 2)9runnables << lambda { puts "Report on People" }10runnables << lambda { puts "Name\tAge" }11runnables << lambda { puts "====\t===" }12runnables << lambda { puts }13runnables << lambda { puts "Report on Dogs" }14runnables << lambda { puts "Name\tAge" }15runnables << lambda { puts "====\t===" }16report(runnables)17 def initialize(name, age)

Full Screen

Full Screen

runnables

Using AI Code Generation

copy

Full Screen

1 @runnables = {}2 runnables = {}3 runnables[r] = YAML.load_file(r)

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Minitest_ruby automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful