Sha256: 6b4e1725b91ef35f2192b7ed167938c522797b27610172a05ceec655e2f08629

Contents?: true

Size: 1.25 KB

Versions: 3

Compression:

Stored size: 1.25 KB

Contents

RSpec.describe ChromedriverScreenshot::Page do
  context "#initialize" do
    subject { ChromedriverScreenshot::Page.new }

    before(:example) do
      platform = double("platform", page_height: 100, window_height: window_height)
      allow(ChromedriverScreenshot::Platforms).to receive(:platform).and_return(platform)
      expect(ChromedriverScreenshot::Row).to receive(:from_boundaries).with(expected_ary)
    end

    context "page height is a multiple of window height" do
      let(:window_height) { 20 }
      let(:expected_ary) { [20, 40, 60, 80, 100] }

      it "returns even boundaries" do
        subject
      end
    end

    context "page height is not a multiple of window height" do
      let(:window_height) { 30 }
      let(:expected_ary) { [30, 60, 90, 100] }

      it "returns partial boundaries" do
        subject
      end
    end

    context "page height is equal to window height" do
      let(:window_height) { 100 }
      let(:expected_ary) { [100] }

      it "returns single even boundary" do
        subject
      end
    end

    context "page height is smaller than window height" do
      let(:window_height) { 200 }
      let(:expected_ary) { [100] }

      it "returns single partial boundary" do
        subject
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
chromedriver-screenshot-0.4.0 spec/chromedriver-screenshot/page_spec.rb
chromedriver-screenshot-0.3.0 spec/chromedriver-screenshot/page_spec.rb
chromedriver-screenshot-0.2.4 spec/chromedriver-screenshot/page_spec.rb