Sha256: 41034d5181e495df652c7a063a0d10517d4ba2563eec88535f7570eaf2e0b4de

Contents?: true

Size: 707 Bytes

Versions: 1

Compression:

Stored size: 707 Bytes

Contents

shared_examples_for "session with screenshot support" do
  describe "#save_screenshot" do
    let(:image_path) { File.join(Dir.tmpdir, 'capybara-screenshot.png') }

    before do
      @session.visit '/'
      @session.save_screenshot image_path
    end

    it "should generate PNG file" do
      magic = File.read(image_path, 4)
      magic.should eq "\x89PNG"
    end
  end
end

shared_examples_for "session without screenshot support" do
  describe "#save_screenshot" do
    before do
      @session.visit('/')
    end

    it "should raise an error" do
      running {
        @session.save_screenshot 'raise_error.png'
      }.should raise_error(Capybara::NotSupportedByDriverError)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
capybara-2.0.0.beta2 lib/capybara/spec/session/screenshot.rb