Sha256: 3707f83bee39a0c4ffd93f6344a129afffeb500ce146ad949ec14b4ffa6df438

Contents?: true

Size: 1.18 KB

Versions: 23

Compression:

Stored size: 1.18 KB

Contents

require "spec_helper"

describe "Pliny integration test" do
  before(:all) do
    FileUtils.rm_rf("/tmp/plinytest")
    FileUtils.mkdir_p("/tmp/plinytest")
    Dir.chdir("/tmp/plinytest")

    bash "pliny-new myapp"
    bash_app "bin/setup"
  end

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

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

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

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

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

    it "creates the schema file" do
      assert File.exists?("./myapp/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

  def bash_app(cmd)
    bash "cd myapp && #{cmd}"
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
pliny-0.21.0 spec/integration_spec.rb
pliny-0.20.2 spec/integration_spec.rb
pliny-0.20.1 spec/integration_spec.rb
pliny-0.20.0 spec/integration_spec.rb
pliny-0.19.0 spec/integration_spec.rb
pliny-0.18.0 spec/integration_spec.rb
pliny-0.17.1 spec/integration_spec.rb
pliny-0.17.0 spec/integration_spec.rb
pliny-0.16.3 spec/integration_spec.rb
pliny-0.16.2 spec/integration_spec.rb
pliny-0.16.1 spec/integration_spec.rb
pliny-0.16.0 spec/integration_spec.rb
pliny-0.15.1 spec/integration_spec.rb
pliny-0.15.0 spec/integration_spec.rb
pliny-0.14.2 spec/integration_spec.rb
pliny-0.14.1 spec/integration_spec.rb
pliny-0.14.0 spec/integration_spec.rb
pliny-0.13.1 spec/integration_spec.rb
pliny-0.13.0 spec/integration_spec.rb
pliny-0.12.0 spec/integration_spec.rb