Sha256: 04efd25781815873586e86200ceca1e6956eee8f771f0125e80a36ff6e2a47d3

Contents?: true

Size: 1.06 KB

Versions: 5

Compression:

Stored size: 1.06 KB

Contents

require 'spec_helper'
require 'generators/transponder/presenter/presenter_generator'

describe Transponder::Generators::PresenterGenerator do 
  destination File.expand_path("../../../../../tmp", __FILE__)

  before { prepare_destination }

  it "should run all tasks" do 
    gen = generator %w(comments)
    gen.should_receive :add_presenter
    gen.should_receive :add_presenter_to_boot
    capture(:stdout) { gen.invoke_all }
  end

  describe "should put presenter in the right place" do 
    subject { file('app/assets/javascripts/application/presenters/comments_presenter.coffee') }
  
    before do 
      FileUtils.cp_r 'spec/fixtures/presenter/app', destination_root

      run_generator %w(comments)
    end

    describe "comments_presenter.coffee" do 
      it { should exist }
      it { should contain /Application.Presenters.CommentPresenter/ }
    end

    describe "initializers/boot.coffee" do 
      subject { file('app/assets/javascripts/application/initializers/boot.coffee') }
      it { should contain /Application.Presenters.CommentPresenter()/ }
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
transponder-0.9.6 spec/generators/transponder/presenter/presenter_generator_spec.rb
transponder-0.9.5 spec/generators/transponder/presenter/presenter_generator_spec.rb
transponder-0.9.4 spec/generators/transponder/presenter/presenter_generator_spec.rb
transponder-0.9.3 spec/generators/transponder/presenter/presenter_generator_spec.rb
transponder-0.9.2 spec/generators/transponder/presenter/presenter_generator_spec.rb