Sha256: de077f132ca3a945d08bb20dc886cb4228cc181b0a84d90d1ea1d4ec700d3099

Contents?: true

Size: 1.07 KB

Versions: 9

Compression:

Stored size: 1.07 KB

Contents

RSpec.describe Rambo::RamlModels::Api do
  let(:raml_file) { File.join(SPEC_DIR_ROOT, "support/secured_api.raml") }
  let(:raml)      { Raml::Parser.parse_file(raml_file) }

  subject { described_class.new(raml, { :token => "foobarbaz" }) }

  describe "#resources" do
    it "has the right number of resources" do
      expect(subject.resources.count).to eql 2
    end

    it "returns an array of Resource objects" do
      all_are_resources = subject.resources.all? {|resource| resource.is_a?(Rambo::RamlModels::Resource) }
      expect(all_are_resources).to be true
    end
  end

  describe "#title" do
    it "returns the API title from the RAML doc" do
      expect(subject.title).to eql raml.title
    end
  end

  describe "#security_schemes" do
    it "returns the security schemes" do
      expect(subject.security_schemes.all? {|scheme| scheme.is_a?(Rambo::RamlModels::SecurityScheme) }).to be true
    end
  end

  describe "headers" do
    it "incorporates API token headers" do
      expect(subject.headers.headers).to include({ "Api-Token" => "foobarbaz" })
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rambo_ruby-0.7.1 spec/lib/rambo/raml_models/api_spec.rb
rambo_ruby-0.7.0 spec/lib/rambo/raml_models/api_spec.rb
rambo_ruby-0.6.0 spec/lib/rambo/raml_models/api_spec.rb
rambo_ruby-0.5.0 spec/lib/rambo/raml_models/api_spec.rb
rambo_ruby-0.4.0 spec/lib/rambo/raml_models/api_spec.rb
rambo_ruby-0.3.3 spec/lib/rambo/raml_models/api_spec.rb
rambo_ruby-0.3.2 spec/lib/rambo/raml_models/api_spec.rb
rambo_ruby-0.3.1 spec/lib/rambo/raml_models/api_spec.rb
rambo_ruby-0.3.0 spec/lib/rambo/raml_models/api_spec.rb