Sha256: c85c592b186cfaa46151eb68bf31da2a250ef5f572efc7dfd79d67eb312d8e7e

Contents?: true

Size: 821 Bytes

Versions: 17

Compression:

Stored size: 821 Bytes

Contents

RSpec.describe LessonsIndexer::Collections::HeadingsList do
  subject { sample_headings }

  context "#for" do
    it "should return heading for a lesson" do
      lesson = double('lesson', major: 2, minor: 5)
      expect(subject.for(lesson)).to eq(subject.first)
    end

    it "should return nil if heading does not exist" do
      lesson = double('lesson', major: 10, minor: 5)
      expect(subject.for(lesson)).to be_nil
    end
  end

  context "#list" do
    it "should respond to #each" do
      expect(subject).to respond_to(:each)
    end

    it "should be sorted properly" do
      sorted_headings = subject.sort
      %w(1.3 2.5 5.8 10.2).each_with_index do |version, index|
        expect(sorted_headings[index].file_name).to eq "lesson#{version}.jpg"
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
lessons_indexer-1.3.0 spec/collections/headings_list_spec.rb
lessons_indexer-1.2.2 spec/collections/headings_list_spec.rb
lessons_indexer-1.2.1 spec/collections/headings_list_spec.rb
lessons_indexer-1.2.0 spec/collections/headings_list_spec.rb
lessons_indexer-1.1.0 spec/collections/headings_list_spec.rb
lessons_indexer-1.0.3 spec/collections/headings_list_spec.rb
lessons_indexer-1.0.2.1 spec/collections/headings_list_spec.rb
lessons_indexer-1.0.0 spec/collections/headings_list_spec.rb
lessons_indexer-0.3.1 spec/collections/headings_list_spec.rb
lessons_indexer-0.3.0 spec/collections/headings_list_spec.rb
lessons_indexer-0.2.3 spec/collections/headings_list_spec.rb
lessons_indexer-0.2.2 spec/collections/headings_list_spec.rb
lessons_indexer-0.2.1 spec/collections/headings_list_spec.rb
lessons_indexer-0.2.0 spec/collections/headings_list_spec.rb
lessons_indexer-0.1.2 spec/collections/headings_list_spec.rb
lessons_indexer-0.1.1 spec/collections/headings_list_spec.rb
lessons_indexer-0.1.0 spec/collections/headings_list_spec.rb