Sha256: ebab921c4440272411d02d3629196a546579772d8aac50ced3348239df52766b

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

require 'spec_helper'

class TestSmoosher
  extend DocSmoosher::TopLevel
end

describe DocSmoosher do
  it 'loads' do
    expect(DocSmoosher).not_to be_nil
  end


  describe 'top level methods' do

    describe 'lets you define' do
      it 'an Api' do
        expect(TestSmoosher.define_api(name: 'test api'){}).to be_true
      end

      it 'a parameter' do
        expect(TestSmoosher.define_parameter(name: 'test param'){}).to be_true
      end

      it 'keeps track of shared parameters' do
        TestSmoosher.define_parameter(name: 'test param'){}

        expect(TestSmoosher.parameters.first.name).to eql('test param')
      end
    end
  end

  describe 'DSL' do
    describe '#define_api' do
      it 'defines an api' do
        TestSmoosher.define_api(name: 'test api') do |api|
          api.description = "a test api example"
        end

        api = TestSmoosher.api
        expect(api).not_to be_nil
        expect(api.name).to eql('test api')
        expect(api.description).to eql('a test api example')
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
doc_smoosher-0.1.0 spec/lib/doc_smoosher_spec.rb
doc_smoosher-0.0.2 spec/lib/doc_smoosher_spec.rb