Sha256: bda232535190c65058efed51da42f15576f2eb983ad3b0f841cbd1cbf50423bf

Contents?: true

Size: 912 Bytes

Versions: 4

Compression:

Stored size: 912 Bytes

Contents

require 'vhost_generator/application'
require 'ostruct'

describe VhostGenerator::Application do
  describe "Options" do
    let(:config) { OpenStruct.new }
    before { subject.config = config }

    options = Hash[
      'static_folder'     => %w(-f --static-folder),
      'server_ports'      => %w(-l --listen),
      'server_names'      => %w(-s --server-name),
      'instance_ports'    => %w(-p --instance-port),
      'relative_root'     => %w(-r --relative-root),
      'generator'         => %w(-g --generator),
      'generator_options' => %w(-o --generator-options)
    ]

    options.each_pair do |name, flags|
      describe "#{name} option" do
        flags.each do |flag|
          it "is set by the #{flag} flag" do
            expect {
              subject.handle_options([flag, 'value'])
            }.to change(config, name).to('value')
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vhost_generator-0.2.2 spec/application_options_spec.rb
vhost_generator-0.2.1 spec/application_options_spec.rb
vhost_generator-0.2.0 spec/application_options_spec.rb
vhost_generator-0.1.0 spec/application_options_spec.rb