Sha256: b49bfb4ca8689a302378b4dc320bec167974712aad27837f49c289bdee849efd

Contents?: true

Size: 1.38 KB

Versions: 4

Compression:

Stored size: 1.38 KB

Contents

require 'spec_helper'

describe Chili::GeneratorProxy do
  let(:app) { DummyApp.new }

  before do
    app.setup!
    puts `cd #{app.path} && rails g chili:feature blank`
  end


  context 'running generator from a newly created feature' do
    it "generates resources properly" do
      puts `cd #{app.path} && rails g blank_feature scaffold post`
      File.exist?(File.join(app.path, 'lib/chili/blank_feature/app/controllers/blank_feature/posts_controller.rb')).should be_true
      File.exist?(File.join(app.path, 'lib/chili/blank_feature/app/assets/stylesheets/blank_feature/posts.css')).should be_true
    end
  end

  context 'running deface override generator' do
    it "generates namespaced override properly" do
      puts `cd #{app.path} && rails g blank_feature deface:override posts/index add_links`
      File.exist?(File.join(app.path, 'lib/chili/blank_feature/app/overrides/posts/index/add_links.html.erb.deface')).should be_true
    end
  end

  context 'passing in options' do
    it "passes options on to rails generator" do
      puts `cd #{app.path} && rails g blank_feature scaffold post --stylesheets=false`
      File.exist?(File.join(app.path, 'lib/chili/blank_feature/app/controllers/blank_feature/posts_controller.rb')).should be_true
      File.exist?(File.join(app.path, 'lib/chili/blank_feature/app/assets/stylesheets/blank_feature/posts.css')).should be_false
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
chili-4.0.1 spec/generators/chili/generator_proxy_spec.rb
chili-4.0.0 spec/generators/chili/generator_proxy_spec.rb
chili-3.1.1 spec/generators/chili/generator_proxy_spec.rb
chili-3.1.0 spec/generators/chili/generator_proxy_spec.rb