Sha256: 98b875b09805e8d61df32c80629d057bbf0316e50218aacf998e028551e50b7c

Contents?: true

Size: 1.76 KB

Versions: 9

Compression:

Stored size: 1.76 KB

Contents

require "./helpers"

describe "App#apps" do
  it "lists app names" do
    with_random_apps do |apps|
      shell("apps").split("\n").should =~
        apps.collect(&:name)
    end
  end

  it "filters by name with --name" do
    with_random_apps do |apps|
      app = apps[rand(apps.size)]

      result = shell("apps", "--name", app.name).split("\n")
      result.should =~ [app.name]
    end
  end

  it "filters by runtime with --runtime" do
    with_random_apps do |apps|
      app = apps[rand(apps.size)]

      result = shell("apps", "--runtime", app.runtime.name).split("\n")
      actual =
        apps.select { |a|
          /#{app.runtime.name}/ =~ a.runtime.name
        }.collect(&:name)

      result.should =~ actual
    end
  end

  it "filters by framework with --framework" do
    with_random_apps do |apps|
      app = apps[rand(apps.size)]

      result = shell("apps", "--framework", app.framework.name).split("\n")
      actual =
        apps.select { |a|
          /#{app.framework.name}/ =~ a.framework.name
        }.collect(&:name)

      result.should =~ actual
    end
  end

  # TODO: use space other than current
  it "can be told which space with --space" do
    with_random_apps do |apps|
      app = apps[rand(apps.size)]

      result = shell("apps", "--space", client.current_space.name).split("\n")
      actual = client.current_space.apps.collect(&:name)

      result.should =~ actual
    end
  end

  # TODO: v2
  #it "filters by url with --url" do
    #with_random_apps do |apps|
      #app = apps[rand(apps.size)]
      #url = app.urls[rand(app.urls.size)]

      #result = shell("apps", "--url", url).split("\n")
      #actual =
        #apps.select { |a|
          #a.urls.include? url
        #}.collect(&:name)

      #result.should =~ actual
    #end
  #end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
vmc-0.4.0.beta.29 vmc-ng/spec/app/apps_spec.rb
vmc-0.4.0.beta.28 vmc-ng/spec/app/apps_spec.rb
vmc-0.4.0.beta.27 vmc-ng/spec/app/apps_spec.rb
vmc-0.4.0.beta.26 vmc-ng/spec/app/apps_spec.rb
vmc-0.4.0.beta.25 vmc-ng/spec/app/apps_spec.rb
vmc-0.4.0.beta.24 vmc-ng/spec/app/apps_spec.rb
vmc-0.4.0.beta.23 vmc-ng/spec/app/apps_spec.rb
vmc-0.4.0.beta.22 vmc-ng/spec/app/apps_spec.rb
vmc-0.4.0.beta.21 vmc-ng/spec/app/apps_spec.rb