Sha256: d40e85ac93957016371b7733914ce1d934527bd61f9274458d3da4a0942271ec

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 KB

Contents

RSpec.describe Percy::Client::Snapshots, :vcr do
  let(:content) { 'hello world!' }
  let(:sha) { Digest::SHA256.hexdigest(content) }

  describe '#create_snapshot' do
    it 'creates a build' do
      build = Percy.create_build('fotinakis/percy-examples')
      resources = []
      resources << Percy::Client::Resource.new('/foo/test.html', sha: sha, is_root: true)
      resources << Percy::Client::Resource.new('/css/test.css', sha: sha)
      snapshot = Percy.create_snapshot(build['data']['id'], resources, name: 'homepage')

      expect(snapshot['data']).to be
      expect(snapshot['data']['id']).to be
      expect(snapshot['data']['type']).to eq('snapshots')
      expect(snapshot['data']['attributes']['name']).to eq('homepage')
      expect(snapshot['data']['relationships']['missing-resources']).to be
    end
    it 'fails if no resources are given' do
      build = Percy.create_build('fotinakis/percy-examples')
      expect do
        Percy.create_snapshot(build['data']['id'], [])
      end.to raise_error(Percy::Client::ClientError)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
percy-client-0.2.2 spec/lib/percy/client/snapshots_spec.rb
percy-client-0.2.1 spec/lib/percy/client/snapshots_spec.rb
percy-client-0.2.0 spec/lib/percy/client/snapshots_spec.rb