Sha256: 5bae54db946520f05d074542b6bebdb4bb915688c02736c6e1232bc78de79bbc

Contents?: true

Size: 838 Bytes

Versions: 3

Compression:

Stored size: 838 Bytes

Contents

require File.dirname(__FILE__) + '/generator_spec_helper'
require 'fileutils'

describe Rhogen::ModelGenerator do

  model_name = 'employee'

  it "should complain if no name is specified" do
    lambda {
      @generator = Rhogen::ModelGenerator.new('/tmp', {})
    }.should raise_error(::Templater::TooFewArgumentsError)
  end

  before do
    @generator = Rhogen::ModelGenerator.new('/tmp', {}, model_name, "http://something.com/sources/5", 5)
  end

  it "should create config.rb, controller.rb, index.erb, edit.erb, and new.erb files" do
    ['config.rb', 'controller.rb', 'index.erb', 'edit.erb', 'new.erb'].each do |template|
      @generator.should create("/tmp/#{model_name.camel_case}/#{template}")
    end
  end
  
  it "should generate valid erb templates" do
    pending "need to figure out how to validate erb"
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rhodes-0.1.0 spec/model_generator_spec.rb
rhodes-0.1.1 spec/model_generator_spec.rb
rhodes-0.1.2 spec/model_generator_spec.rb