Sha256: c44c4233ac308bce0329122f745ba584e3b39bfbb9b8429cb3df29065c1f14e8

Contents?: true

Size: 896 Bytes

Versions: 2

Compression:

Stored size: 896 Bytes

Contents

require 'spec_helper'

describe Flms::Block do
  include NamedFactories

  describe 'associations' do
    it 'has pages' do
      block.pages << page_1
      expect(block).to have(1).pages
      expect(block.pages.first).to eql page_1
    end
  end

  describe 'scroll_duration' do
    let(:block) { create :block }
    let!(:layer_1) { l = block.layers.build(name: 'abc').build_default_keyframes
                     l.start_state_keyframe.scroll_start = 1
                     l.save! }
    let!(:layer_2) { l = block.layers.build(name: 'def').build_default_keyframes
                     l.start_state_keyframe.scroll_start = 2
                     l.save! }

    it 'returns the total scroll duration for the block' do
      expect(block.scroll_duration).to eql 302
    end

    it 'returns 0 when the block has no layers' do
      expect(subject.scroll_duration).to eql 0
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
flms-0.9.0 spec/models/block_spec.rb
flms-0.1.0 spec/models/block_spec.rb