Sha256: b30a69d7d49c70b39e0f26bd562adb1a7790de1e27659f45f5e9b8f944d82a11

Contents?: true

Size: 907 Bytes

Versions: 46

Compression:

Stored size: 907 Bytes

Contents

require_relative "./spec_helper.rb"

describe Section do
	before do
		@mock_citems = 
			[["welcome", :intro, false, 1],
			 ["Day 1", :intro, false, 2],
			 ["Day 1a", :intro, true,3 ]
			].map {|t, s, h, o| double("CItem", title: t,  section: s, hidden?: h, order: o) }
		@sect = Section.new :intro, @mock_citems, false
	end

	it "can find the index" do
		expect( @sect.find_index(@mock_citems[1] )).to eq 1
	end

	it "can look up by index" do
		expect(@sect[1]).to eq @mock_citems[1]
	end

	it "can find next entry" do
		expect( @sect.next_for(@mock_citems[0])).to eq @mock_citems[1]
	end

	it "can find prev entry" do
		expect( @sect.previous_for(@mock_citems[1])).to eq @mock_citems[0]
	end

	it "can deal with first" do
		expect( @sect.previous_for(@mock_citems[0])).to eq @mock_citems[0]
	end

	it "can deal with last" do
		expect( @sect.next_for(@mock_citems[1])).to eq @mock_citems[1]
	end


end


Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
coursegen-0.9.25 spec/section_spec.rb
coursegen-0.9.24 spec/section_spec.rb
coursegen-0.9.21 spec/section_spec.rb
coursegen-0.9.20 spec/section_spec.rb
coursegen-0.9.19 spec/section_spec.rb
coursegen-0.9.18 spec/section_spec.rb
coursegen-0.9.17 spec/section_spec.rb
coursegen-0.9.16 spec/section_spec.rb
coursegen-0.9.15 spec/section_spec.rb
coursegen-0.9.14 spec/section_spec.rb
coursegen-0.9.13 spec/section_spec.rb
coursegen-0.9.12 spec/section_spec.rb
coursegen-0.9.11 spec/section_spec.rb
coursegen-0.9.10 spec/section_spec.rb
coursegen-0.9.9 spec/section_spec.rb
coursegen-0.9.8 spec/section_spec.rb
coursegen-0.9.7 spec/section_spec.rb
coursegen-0.9.6 spec/section_spec.rb
coursegen-0.9.4 spec/section_spec.rb
coursegen-0.9.3 spec/section_spec.rb