Sha256: 3511ab18c0b65364ded352c474b7e09bea53974517e62fa8c5dcbc214d879888

Contents?: true

Size: 960 Bytes

Versions: 3

Compression:

Stored size: 960 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

describe Azeroth::RoutesBuilder do
  subject(:routes_builder) do
    described_class.new(model, builder, options)
  end

  let(:model)        { Azeroth::Model.new(:document) }
  let(:builder)      { Sinclair.new(klass) }
  let(:klass)        { Class.new(RoutesBuilderController) }
  let(:instance)     { klass.new(params) }
  let(:params)       { {} }
  let(:options)      { Azeroth::Options.new(options_hash) }
  let(:options_hash) { {} }

  before do
    routes_builder.append
    10.times { Document.create }
  end

  describe '#append' do
    before { routes_builder.append }

    it 'adds index route' do
      expect do
        builder.build
      end.to add_method(:index).to(klass.new)
    end

    describe 'when calling index' do
      before { builder.build }

      it 'returns the index object' do
        expect(instance.perform(:index)).to eq(json: 'index_json')
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
azeroth-0.0.7 spec/lib/azeroth/routes_builder_spec.rb
azeroth-0.0.6 spec/lib/azeroth/routes_builder_spec.rb
azeroth-0.0.5 spec/lib/azeroth/routes_builder_spec.rb