Sha256: 22189f43c4be80425660fec17d0ac590f0380cc7203cf5c9cb8ae8205b4f5bb2

Contents?: true

Size: 1.24 KB

Versions: 4

Compression:

Stored size: 1.24 KB

Contents

require 'spec_helper'

class Taza::Site
  def flows
    flows = []
    Dir.glob(File.join(path,'flows','*.rb')).each do |file|
      require file

      flows << "#{self.class.parent.to_s}::#{File.basename(file,'.rb').camelize}".constantize
    end
    flows
  end
end

describe "Flow Generation" do
  include RubiGen::GeneratorTestHelper
  include Helpers::Generator
  include Helpers::Taza

  before :all do
    @site_name = "Foo"
    @site_folder = File.join(PROJECT_FOLDER,'lib','sites',"gap")
    @site_file = File.join(PROJECT_FOLDER,'lib','sites',"gap.rb")
    @flow_name = "CheckOut"
  end

  before :each do
    run_generator('taza', [APP_ROOT], generator_sources)
    @site_class = generate_site(@site_name)
  end

  after :each do
    bare_teardown
  end

  it "should give you usage if you do not give two arguments" do
    FlowGenerator.any_instance.expects(:usage)
    lambda { run_generator('flow', [@flow_name], generator_sources) }.should raise_error
  end

  it "should give you usage if you give a site that does not exist" do
    FlowGenerator.any_instance.expects(:usage)
    $stderr.expects(:puts).with(regexp_matches(/NoSuchSite/))
    lambda { run_generator('flow', [@flow_name,"NoSuchSite"], generator_sources) }.should raise_error
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
taza-0.9.1.2 spec/flow_generator_spec.rb
taza-0.9.1.1 spec/flow_generator_spec.rb
taza-0.9.1 spec/flow_generator_spec.rb
taza-0.9.0 spec/flow_generator_spec.rb