Sha256: ff8a7ea80caec7fa0a9d3b921a10ecd816177a59abea0b07ceacd99a6a45b238
Contents?: true
Size: 1.31 KB
Versions: 1
Compression:
Stored size: 1.31 KB
Contents
require 'janus/configuration' require 'janus/screenshot' require 'janus/command/validate' describe Janus::Command::Validate do let(:config) { Janus::Configuration.new({}) } let(:validate) { Janus::Command::Validate.new(config) } describe '#execute' do it 'validates screenshots for each configured test' do config.stub(:tests) { %w(one two) } validate.should_receive(:validate_screenshot).with('one') validate.should_receive(:validate_screenshot).with('two') validate.execute end end describe '#validate_screenshot' do let(:test) { Janus::Test.new('name' => 'my test') } let(:original) { Janus::Screenshot.new } let(:fresh) { Janus::Screenshot.new } before :each do Janus::Screenshot.stub(:load) { original } Janus::Screenshot.stub(:capture) { fresh } end it 'raises exception when screenshots do not match' do original.stub(:image) { 'original data' } fresh.stub(:image) { 'changes' } expect { validate.validate_screenshot(test) }.to raise_error('my test: Screenshots did not match!') end it 'does not raise exception when screenshots match' do original.stub(:image) { 'original data' } fresh.stub(:image) { 'original data' } expect { validate.validate_screenshot(test) }.not_to raise_error end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
janus-cli-0.1.0 | spec/janus/command/validate_spec.rb |