Sha256: 7b748973e957817e27b6bd984c23f2bd7d4cfa12917d998d083c09bde3c864dc

Contents?: true

Size: 993 Bytes

Versions: 2

Compression:

Stored size: 993 Bytes

Contents

require 'spec_helper'
require 'generators/admin_panel/scaffold/scaffold_generator'

describe AdminPanel::Generators::ScaffoldGenerator do
  destination File.expand_path('../../../../../tmp', __FILE__)

  before do
    prepare_destination
    prepare_rails_dummy
  end

  describe 'scaffolder' do
    before { run_generator(%w(post title:string description:text public:boolean)) }
    # @see spec/dummy/bin/rails
    it_should_exist 'app/models/post.rb'

    describe 'posts controller' do
      subject { file('app/controllers/admin/posts_controller.rb') }
      it { should exist }
      it { should contain 'include Administrable' }
      it { should contain '@posts = Post.all' }
    end

    it_should_exist 'app/views/admin/posts/index.html.erb'
    it_should_exist 'app/views/admin/posts/edit.html.erb'
    it_should_exist 'app/views/admin/posts/show.html.erb'
    it_should_exist 'app/views/admin/posts/new.html.erb'
    it_should_exist 'app/views/admin/posts/_form.html.erb'

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
admin-panel-0.1.3 spec/generators/admin_panel/scaffold/scaffold_generator_spec.rb
admin-panel-0.1.2 spec/generators/admin_panel/scaffold/scaffold_generator_spec.rb