Sha256: 32d17ff6e7ac2aad4b14c8e367cb384ffd26dee77eeefba55c66d4bc4db21be3

Contents?: true

Size: 960 Bytes

Versions: 1

Compression:

Stored size: 960 Bytes

Contents

require 'spec_helper'
require './lib/insta_swag/static_files'

describe InstaSwag::StaticFiles do

	include FileHelper

	subject do
		InstaSwag::StaticFiles.new(settings)
	end

	let(:settings) do
		{ :api_version => 'v1.0', :mount_path => '/swagger-docs', :hide_documentation_path => true,
		 :base_path => '/api', :url => 'microservices.com', :port => 10100, :endpoint => "/accounts" }
	end

	let(:fixture_path) { Dir.pwd + "/fixtures/public/docs/index.html" }

	let(:generated_path) { Dir.pwd + "/public/docs/index.html" }

	let(:template) { File.read(subject.index_path) }

	let(:readed_template) { double('template') }

	context '#eval_and_read' do

		it "writes to the static file based on settings passed" do
			allow(ERB).to receive(:new).with(template).and_return(readed_template)
			expect(readed_template).to receive(:result)
			allow(settings).to receive(:prefix_path).and_return(nil.to_s)
			subject.eval_and_read(subject.index_path)
		end
	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
insta_swag-0.1.1 spec/insta_swag/static_files_spec.rb