Sha256: bd8326c321639cb14f2cbc6136c8644ced17598acd9e47e0d6b7c7cc3acdba5e

Contents?: true

Size: 1.05 KB

Versions: 8

Compression:

Stored size: 1.05 KB

Contents

require 'spec_helper'

RAW_PROJECT = data_from_json 'project_success.json'

describe Dribbble::Project do
  describe 'on instance' do
    before :all do
      @project = Dribbble::Project.new 'valid_token', RAW_PROJECT
    end

    describe 'after initialization' do
      RAW_PROJECT.each do |field, value|
        it "respond to #{field}" do
          expect(@project.send field).to eq(value)
        end
      end
    end

    describe 'on #shots' do
      subject do
        stub_dribbble :get, '/projects/3/shots', DribbbleAPI::ShotsSuccess
        @project.shots
      end

      it 'responds with shots' do
        expect(subject.size).to eq 2
        expect(subject.first).to be_a Dribbble::Shot
      end
    end
  end

  describe 'on class' do
    describe 'on #find' do
      subject do
        stub_dribbble :get, '/projects/3', DribbbleAPI::ProjectSuccess
        Dribbble::Project.find 'valid_token', 3
      end

      it 'return a project' do
        expect(subject).to be_a Dribbble::Project
        expect(subject.id).to eq(3)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
dribbble-1.2.0 spec/lib/dribbble/project_spec.rb
dribbble-1.1.0 spec/lib/dribbble/project_spec.rb
dribbble-1.0.4 spec/lib/dribbble/project_spec.rb
dribbble-1.0.2 spec/lib/dribbble/project_spec.rb
dribbble-1.0.1 spec/lib/dribbble/project_spec.rb
dribbble-1.0.0 spec/lib/dribbble/project_spec.rb
dribbble-1.0.0.beta2 spec/lib/dribbble/project_spec.rb
dribbble-1.0.0.beta1 spec/lib/dribbble/project_spec.rb