Sha256: 5e498f0ecb59fe3e72e2bbe016a3f15760f134192b3edbdc2fcaf5f49523610a

Contents?: true

Size: 1.07 KB

Versions: 5

Compression:

Stored size: 1.07 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.CommentsPresenter/ }
    end

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
transponder-2.0.0 spec/generators/transponder/presenter/presenter_generator_spec.rb
transponder-1.0.0 spec/generators/transponder/presenter/presenter_generator_spec.rb
transponder-0.10.4 spec/generators/transponder/presenter/presenter_generator_spec.rb
transponder-0.10.2 spec/generators/transponder/presenter/presenter_generator_spec.rb
transponder-0.10.1 spec/generators/transponder/presenter/presenter_generator_spec.rb