Sha256: 2d2c033dc5cbade26460df64b64a6b4828cf1e60e781e52d7801cfd4413130ae

Contents?: true

Size: 1 KB

Versions: 1

Compression:

Stored size: 1 KB

Contents

require 'janus/configuration'
require 'janus/test'
require 'janus/command/record'

describe Janus::Command::Record do
  let(:config) { Janus::Configuration.new({}) }
  let(:record) { Janus::Command::Record.new(config) }

  describe '#execute' do
    it 'records screenshot for each configured test' do
      config.stub(:tests) { ['one', 'two'] }

      record.should_receive(:record_screenshot).with('one')
      record.should_receive(:record_screenshot).with('two')

      record.execute
    end
  end

  describe '#record_screenshot' do
    let(:test) { Janus::Test.new({ name: 'name', url: 'ur' }) }
    let(:screenshot) { double }
    let(:recorder) { double }

    it 'saves screenshot of test URL' do
      config.stub(:username) { 'username' }
      config.stub(:access_key) { 'access key' }

      Janus::Screenshot.should_receive(:capture).with(test, username: 'username', access_key: 'access key').and_return(screenshot)

      screenshot.should_receive(:save)

      record.record_screenshot(test)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
janus-cli-0.1.0 spec/janus/command/record_spec.rb