Sha256: 08609fe5dee29fa9ab25caeb8c937bfe814e645c37eb51e1e9e339a8f912b024
Contents?: true
Size: 1.54 KB
Versions: 2
Compression:
Stored size: 1.54 KB
Contents
require_relative "../../../lib/rankum/readers/rank_file_reader" module Rankum module Readers describe RankFileReader do let(:subject) { RankFileReader.new } context "when adding a path to the perfect rank as a txt file" do let(:perfect_rank_path) { "spec/fixtures/perfect_rank.txt" } before { subject.add_perfect_rank_path(perfect_rank_path) } it "should convert to a list" do expect(subject.perfect_rank).to be_a_kind_of(Array) end it "should add position number to each item rank" do expected_list = ("A".."Z").to_a expect(subject.perfect_rank).to eq(expected_list) end end context "when adding a path to the actual rank as a txt file" do let(:actual_rank_path) { "spec/fixtures/actual_rank.txt" } before { subject.add_actual_rank_path(actual_rank_path) } it "should convert to a list" do expect(subject.actual_rank).to be_a_kind_of(Array) end it "should add position number to each item rank" do expected_list = ("A".."Z").to_a.reverse expect(subject.actual_rank).to eq(expected_list) end end context "when has repeated pairs" do let(:rank_path) { "spec/fixtures/repeated_rank.txt" } before { subject.add_perfect_rank_path(rank_path) } let(:expected_list) { ["hot", "hot", "fresh", "vip", "piv"] } it "should returned a ordered list" do expect(subject.perfect_rank).to eq(expected_list) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rankum-1.1.0 | spec/rankum/readers/rank_file_reader_spec.rb |
rankum-1.0.0 | spec/rankum/readers/rank_file_reader_spec.rb |