Sha256: ac133cab84a40266733d94b5bcbccbc946d151702dc8f4244e2a099669996253

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

require 'spec_helper'

include Restspec::Schema

describe Attribute do
  let(:type) { double }

  describe '#example' do
    let(:example) { 'example' }
    let(:attribute) { Attribute.new(:name, type, example: example) }

    it 'returns the example option' do
      expect(attribute.example).to eq(example)
    end
  end

  describe '#can_generate_examples?' do
    subject { attribute.can_generate_examples? }

    context 'without the option' do
      let(:attribute) { Attribute.new(:name, type, example: 'example', :for => []) }
      it { should eq(false) }
    end

    context 'with the option' do
      let(:attribute) { Attribute.new(:name, type, example: 'example', :for => [:examples]) }
      it { should eq(true) }
    end
  end

  describe '#can_be_checked?' do
    subject { attribute.can_be_checked? }

    context 'without the option' do
      let(:attribute) { Attribute.new(:name, type, :for => []) }
      it { should eq(false) }
    end

    context 'with the option' do
      let(:attribute) { Attribute.new(:name, type, :for => [:checks]) }
      it { should eq(true) }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
restspec-0.1 spec/restspec/schema/attribute_spec.rb