Sha256: 793794cb7820f3085991e80d08013ccb2cc9d031a7ef74448895c6d8842526a3

Contents?: true

Size: 1.18 KB

Versions: 5

Compression:

Stored size: 1.18 KB

Contents

require 'spec_helper'

# Generators are not automatically loaded by Rails
require 'generators/puffer/controller/controller_generator'

describe Puffer::ControllerGenerator do
  describe 'controller namespaced in admin module added by default' do
    before { run_generator %w(User name:string email:string)  }

    describe 'app/controllers/admin/users_controller.rb' do
      subject { file('app/controllers/admin/users_controller.rb') }
      it { should exist }
      it { should contain "class Admin::UsersController < Puffer::Base" }
      it { should contain "# field :id" }
      it { should contain "field :email" }
      it { should contain "field :password" }
      it { should contain "# field :created_at" }
      it { should contain "# field :updated_at" }
    end
  end

  describe 'controller namespace can be specified in admin module added by default' do
    before { run_generator %w(Moderator::User name:string email:string)  }

    describe 'app/controllers/moderator/users_controller.rb' do
      subject { file('app/controllers/moderator/users_controller.rb') }
      it { should exist }
      it { should contain "class Moderator::UsersController < Puffer::Base" }
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
puffer-0.1.1 spec/generators/puffer/controller/controller_generator_spec.rb
puffer-0.1.0 spec/generators/puffer/controller/controller_generator_spec.rb
puffer-0.0.32 spec/generators/puffer/controller/controller_generator_spec.rb
puffer-0.0.31 spec/generators/puffer/controller/controller_generator_spec.rb
puffer-0.0.30 spec/generators/puffer/controller/controller_generator_spec.rb