Sha256: d6e6a18ea46244b461fe3649220c68ba7964feb9f4aa7824206e0c56a2dee9c7

Contents?: true

Size: 1.45 KB

Versions: 13

Compression:

Stored size: 1.45 KB

Contents

RSpec.describe Rambo::RSpec::SpecFile do
  let(:raw_raml)  { Raml::Parser.parse_file(raml_file) }
  let(:options)   { { rails: true } }
  let(:raml)      { Rambo::RamlModels::Api.new(raw_raml) }
  let(:spec_file) { Rambo::RSpec::SpecFile.new(raw_raml, options) }

  before(:each) do
    FileUtils.mkdir_p(File.expand_path("spec/support/examples"))
  end

  after(:each) do
    FileUtils.rm_rf(File.expand_path("spec/support/examples"))
  end

  context "file with examples" do
    let(:raml_file) { File.join(SPEC_DIR_ROOT, "support/foobar.raml") }

    describe "#initialize" do
      it "assigns @raml" do
        expect(spec_file.raml).not_to be_nil
      end

      it "uses the correct schema" do
        expect(spec_file.raml.schema).to eq raw_raml
      end
    end

    describe "#template" do
      it "is a string" do
        expect(spec_file.template.is_a?(String)).to be true
      end
    end

    describe "#render" do
      it "interpolates the correct values" do
        expect(spec_file.render).to include("e-BookMobile API")
      end
    end
  end

  context "file with schema" do
    let(:raml_file) do
      File.join(RAMBO_ROOT, "../features/support/examples/raml/basic_raml_with_schema.raml")
    end

    describe "#initialize" do
      it "assigns @raml" do
        expect(spec_file.raml).not_to be_nil
      end
    end

    describe "#template" do
      it "is a string" do
        expect(spec_file.template.is_a?(String)).to be true
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
rambo_ruby-0.7.1 spec/lib/rambo/rspec/spec_file_spec.rb
rambo_ruby-0.7.0 spec/lib/rambo/rspec/spec_file_spec.rb
rambo_ruby-0.6.0 spec/lib/rambo/rspec/spec_file_spec.rb
rambo_ruby-0.5.0 spec/lib/rambo/rspec/spec_file_spec.rb
rambo_ruby-0.4.0 spec/lib/rambo/rspec/spec_file_spec.rb
rambo_ruby-0.3.3 spec/lib/rambo/rspec/spec_file_spec.rb
rambo_ruby-0.3.2 spec/lib/rambo/rspec/spec_file_spec.rb
rambo_ruby-0.3.1 spec/lib/rambo/rspec/spec_file_spec.rb
rambo_ruby-0.3.0 spec/lib/rambo/rspec/spec_file_spec.rb
rambo_ruby-0.2.3 spec/lib/rambo/rspec/spec_file_spec.rb
rambo_ruby-0.2.2 spec/lib/rambo/rspec/spec_file_spec.rb
rambo_ruby-0.2.1 spec/lib/rambo/rspec/spec_file_spec.rb
rambo_ruby-0.2.0 spec/lib/rambo/rspec/spec_file_spec.rb