Sha256: e941abd6bcabc651030366dc370fa4d42ed6029fde209bce53b065f937ba2a35

Contents?: true

Size: 1.62 KB

Versions: 110

Compression:

Stored size: 1.62 KB

Contents

# encoding: utf-8
require 'spec_helper'

describe Picky::Generators::Selector do

  describe "main class" do
    before(:each) do
      @selector = Picky::Generators::Selector.new
    end

    describe "generator_for_class" do
      it "should return me a generator for the given class" do
        @selector.generator_for_class(Picky::Generators::Server::Sinatra, :identifier, :some_args).should be_kind_of(Picky::Generators::Server::Sinatra)
      end
    end

    describe "generator_for" do
      it "should not raise if a generator is available" do
        lambda { @selector.generator_for('client', 'some_project') }.should_not raise_error
      end
      it "should not raise if a generator is available" do
        lambda { @selector.generator_for('server', 'some_project') }.should_not raise_error
      end
      it "should not raise if a generator is available" do
        lambda { @selector.generator_for('all_in_one', 'some_project') }.should_not raise_error
      end
      it "should raise if a generator is not available" do
        lambda { @selector.generator_for('blarf', 'gnorf') }.should raise_error(Picky::Generators::NotFoundException)
      end
    end

    describe "generate" do
      it "should raise a NoGeneratorException if called with the wrong params" do
        lambda { @selector.generate('blarf', 'gnorf') }.should raise_error(Picky::Generators::NotFoundException)
      end
      it "should not raise on the right params" do
        @selector.stub! :generator_for_class => stub(:generator, :generate => nil)

        lambda { @selector.generate('client', 'some_project') }.should_not raise_error
      end
    end
  end

end

Version data entries

110 entries across 110 versions & 1 rubygems

Version Path
picky-generators-4.21.2 spec/lib/picky-generators/generators/selector_spec.rb
picky-generators-4.21.1 spec/lib/picky-generators/generators/selector_spec.rb
picky-generators-4.21.0 spec/lib/picky-generators/generators/selector_spec.rb
picky-generators-4.20.2 spec/lib/picky-generators/generators/selector_spec.rb
picky-generators-4.20.1 spec/lib/picky-generators/generators/selector_spec.rb
picky-generators-4.20.0 spec/lib/picky-generators/generators/selector_spec.rb
picky-generators-4.19.7 spec/lib/picky-generators/generators/selector_spec.rb
picky-generators-4.19.6 spec/lib/picky-generators/generators/selector_spec.rb
picky-generators-4.19.5 spec/lib/picky-generators/generators/selector_spec.rb
picky-generators-4.19.4 spec/lib/picky-generators/generators/selector_spec.rb
picky-generators-4.19.3 spec/lib/picky-generators/generators/selector_spec.rb
picky-generators-4.19.2 spec/lib/picky-generators/generators/selector_spec.rb
picky-generators-4.19.1 spec/lib/picky-generators/generators/selector_spec.rb
picky-generators-4.19.0 spec/lib/picky-generators/generators/selector_spec.rb
picky-generators-4.18.0 spec/lib/picky-generators/generators/selector_spec.rb
picky-generators-4.17.1 spec/lib/picky-generators/generators/selector_spec.rb
picky-generators-4.17.0 spec/lib/picky-generators/generators/selector_spec.rb
picky-generators-4.16.0 spec/lib/picky-generators/generators/selector_spec.rb
picky-generators-4.15.1 spec/lib/picky-generators/generators/selector_spec.rb
picky-generators-4.15.0 spec/lib/picky-generators/generators/selector_spec.rb