Sha256: 7092e1ac6ff54aa60c12512af17a316e13640b4f1d81d5415568e6fb2d3cc06a

Contents?: true

Size: 1.15 KB

Versions: 5

Compression:

Stored size: 1.15 KB

Contents

require "spec_helper"

describe "Pliny integration test" do
  before(:all) do
    @original_dir = Dir.pwd

    test_dir = Dir.mktmpdir("plinytest-")
    Dir.chdir(test_dir)

    bash "pliny-new myapp"

    Dir.chdir("myapp")
    bash "bin/setup"
  end

  after(:all) do
    Dir.chdir(@original_dir)
  end

  describe "bin/setup" do
    it "generates .env" do
      assert File.exist?("./.env")
    end
  end

  describe "pliny-generate scaffold" do
    before(:all) do
      bash "pliny-generate scaffold artist"
    end

    it "creates the model file" do
      assert File.exist?("./lib/models/artist.rb")
    end

    it "creates the endpoint file" do
      assert File.exist?("./lib/endpoints/artists.rb")
    end

    it "creates the serializer file" do
      assert File.exist?("./lib/serializers/artist.rb")
    end

    it "creates the schema file" do
      assert File.exist?("./schema/schemata/artist.yaml")
    end
  end

  def bash(cmd)
    bin  = File.expand_path('../bin', File.dirname(__FILE__))
    path = "#{bin}:#{ENV["PATH"]}"
    env = { "PATH" => path }
    unless system(env, "#{cmd} > /dev/null")
      raise "Failed to run #{cmd}"
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pliny-0.31.0 spec/integration_spec.rb
pliny-0.30.1 spec/integration_spec.rb
pliny-0.30.0 spec/integration_spec.rb
pliny-0.29.0 spec/integration_spec.rb
pliny-0.28.0 spec/integration_spec.rb