Sha256: 6a0805b381a5667187544f351043c153cec8c651c18c61c5ce2ea1a289aedcb4

Contents?: true

Size: 1.67 KB

Versions: 13

Compression:

Stored size: 1.67 KB

Contents

require 'spec_helper'

describe Jax::PluginManager do
  def shell
    @shell ||= GenSpec::Shell.new
  end
  
  def input(str)
    shell.new shell.output, str
  end
  
  def destination_root
    @destination_root ||= ::Rails.application.root.to_s
  end

  def generate(*args)
    Jax::PluginManager.start args, :shell => shell, :destination_root => destination_root
    shell.output.string.tap { shell.new }
  end
  
  def generate_plugin(name)
    Jax::Generators::PluginGenerator.start([name], :shell => shell, :destination_root => ::Rails.application.root)
    shell.new
    @destination_root = ::Rails.application.root.join('vendor/plugins', name).to_s
    Jax::Plugin::Manifest.new(name)
  end
  
  it "push plugin with edited manifest" do
    manifest = generate_plugin 'cloud'
    manifest.description = "a cloudy day"
    manifest.save
  
    # how to test success? A file has been uploaded. For now we'll just verify nothing raised...
    input "sinisterchipmunk@gmail.com\npassword\n"
    proc { generate 'push' }.should_not raise_error
  end

  it "push plugin with default manifest" do
    generate_plugin 'cloud'
    result = generate "push"
    result.should =~ /enter a plugin description/
  end

  it "push plugin without manifest" do
    generate_plugin 'cloud'
    manifest = local "vendor/plugins/cloud/manifest.yml"
    FileUtils.rm manifest if File.file?(manifest)

    result = generate "push"

    result.should =~ /manifest is missing/i
    result.should =~ /create/
    File.should be_file(manifest)
  end

  it "push plugin outside plugin dir" do
    generate_plugin 'cloud'
    @destination_root = local(".")
    result = generate "push"
    result.should =~ /aborted/i
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
jax-2.0.12 spec/lib/jax/commands/plugin_manager/push_spec.rb
jax-2.0.11 spec/lib/jax/commands/plugin_manager/push_spec.rb
jax-2.0.10 spec/lib/jax/commands/plugin_manager/push_spec.rb
jax-2.0.9 spec/lib/jax/commands/plugin_manager/push_spec.rb
jax-2.0.8 spec/lib/jax/commands/plugin_manager/push_spec.rb
jax-2.0.7 spec/lib/jax/commands/plugin_manager/push_spec.rb
jax-2.0.6 spec/lib/jax/commands/plugin_manager/push_spec.rb
jax-2.0.5 spec/lib/jax/commands/plugin_manager/push_spec.rb
jax-2.0.4 spec/lib/jax/commands/plugin_manager/push_spec.rb
jax-2.0.3 spec/lib/jax/commands/plugin_manager/push_spec.rb
jax-2.0.2 spec/lib/jax/commands/plugin_manager/push_spec.rb
jax-2.0.1 spec/lib/jax/commands/plugin_manager/push_spec.rb
jax-2.0.0 spec/lib/jax/commands/plugin_manager/push_spec.rb