Sha256: 7407133bc86fd59ff0c4c134a139364f8219e74c423c80bff793fabbf7206547

Contents?: true

Size: 1.5 KB

Versions: 3

Compression:

Stored size: 1.5 KB

Contents

describe 'screenshot testing under bacon' do
  extend Juxtapose

  tests TestController

  it "raises an error when no accepted screenshot is present" do
    error = nil
    begin
      it_should_look_like "no accepted screenshot"
    rescue RuntimeError => e
      error = e
    end
    error.should.not.be.nil
    error.message.should =~ /No accepted screen shot for/
  end

  it "passes when there is an identical accepted screenshot" do
    it_should_look_like "accepted screenshot"
  end

  it "raises an error and produces diffs on failure" do
    Dispatch::Queue.main.async do
      view("Juxtapose").text = "Changed!"
    end

    wait 1.0 do
      error = nil
      begin
        it_should_look_like "going to differ screenshot"
      rescue RuntimeError => e
        error = e
      end
      error.should.not.be.nil
      error.message.should =~ /Screenshot did not match/

      spec_dir = "spec/screens/iphone-retina-6/ios_8.3/screenshot-testing-under-bacon-raises-an-error-and-produces-diffs-on-failure/going-to-differ-screenshot"

      File.should.exist(File.join( ENV["RUBYMOTION_PROJECT_DIR"], spec_dir, "current.png"))
      File.should.exist(File.join( ENV["RUBYMOTION_PROJECT_DIR"], spec_dir, "diff.png"))
    end
  end

  it "raises an error when screens are different sizes" do
    error = nil
    begin
      it_should_look_like "different sized screenshot"
    rescue RuntimeError => e
      error = e
    end
    error.should.not.be.nil
    error.message.should =~ /Screenshots are different sizes/
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
motion-juxtapose-0.3.2 spec/controllers/test_controller_spec.rb
motion-juxtapose-0.3.1 spec/controllers/test_controller_spec.rb
motion-juxtapose-0.3.0 spec/controllers/test_controller_spec.rb