Skip to content

Instantly share code, notes, and snippets.

View gabrielms's full-sized avatar

Gabriel gabrielms

  • Controlle
  • Brazil
View GitHub Profile
require 'spec_helper_lite'
require 'enumerate_it'
require 'app/services/score_rounder'
require 'app/enumerations/rounding_table_action'
RSpec.describe ScoreRounder, type: :service do
let(:exam_rule) { double(:exam_rule) }
let(:rounding_table) { double(:rounding_table) }
let(:rounding_table_value) { double(:rounding_table_value) }
class ScoreRounder
def initialize(exam_rule)
raise ArgumentError unless exam_rule
@exam_rule = exam_rule
end
def round(score)
return 0 if score.nil?
return score if score > 10.0
class StudentAverageCalculator
def initialize(student)
@student = student
end
def calculate(discipline_id, school_calendar_step_id)
averages_sum = 0
step = SchoolCalendarStep.find(school_calendar_step_id)
daily_notes = DailyNoteStudent
.by_student_id(@student.id)
"minha string".class
123.class
nil.class
false.class
"minhastring".class