This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"valor".reverse |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"string".reverse |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"minha string".class | |
123.class | |
nil.class | |
false.class |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"minhastring".class |