Sha256: 46301da893b2f713bb279f6202faf803ae05875e78439699e84e79195e7b2eb3

Contents?: true

Size: 1.1 KB

Versions: 3

Compression:

Stored size: 1.1 KB

Contents

require 'spec_helper'
include Capybara::DSL

describe 'rspec matcher' do

  before(:each) do
    @black_box = 'black.png'
    @ref_path = Gatling.reference_image_path = File.join(spec_support_root, 'ref_path')
    create_images_for_web_page
  end

  after(:each) do
    config_clean_up
    remove_refs(@ref_path)
  end

  describe 'initializing and runnin gatling' do

    it 'will pass if images matches reference' do
      create_square_image(@ref_path, 'black')
       black_element = element_for_spec("#black")
      black_element.should look_like("black.png")
    end

    it "will fail if images doesn't matches reference" do
      create_square_image(@ref_path, 'black')
      red_element = element_for_spec("#red")
      expect{red_element.should look_like(@black_box)}.should raise_error
    end

    it 'will return true if it makes a new reference image in trainer mode' do
      Gatling::Configuration.trainer_toggle =  true
      black_element = element_for_spec("#black")
      black_element.should look_like(@black_box)
      File.exists?(File.join(@ref_path, @black_box)).should be_true
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gatling-1.1.1 spec/acceptance/rspec_matcher_spec.rb
gatling-1.1.0 spec/acceptance/rspec_matcher_spec.rb
gatling-1.0.9 spec/acceptance/rspec_matcher_spec.rb