Sha256: 80d2b5b14a7ba6451f0c9baa07d6d53b6ff0b131c37919dc408359058882efdf

Contents?: true

Size: 903 Bytes

Versions: 2

Compression:

Stored size: 903 Bytes

Contents

require 'spec_helper'

RSpec.describe SmashingDocs::TestCase do
  let(:test_case) { SmashingDocs::TestCase.new(request, response) }

  describe "#compile_template" do
    context "with text" do
      let(:template) { "<%= 2 + 2 %>" }
      it "evaluates erb and returns a value" do
        test_case.template = template
        expect(test_case.compile_template).to eq("4")
      end
    end

    context "with a template file" do
      let!(:template) { SmashingDocs.config { |c| c.template_file = 'spec/fake_template.md.erb' } }
      it "sets the template file and returns docs matching the template" do
        test_case.template = SmashingDocs::Conf.template
        expect(test_case.compile_template).to include("use ERB")
      end
    end
  end

  describe "#created_at" do
    it "returns the time the TestCase was created" do
      expect(test_case.created_at).to be_a(Time)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
smashing_docs-0.1.0 gem_rspec/test_case_spec.rb
smashing_docs-0.0.2 spec/test_case_spec.rb