Sha256: 1bb0252895f88ee11ad771c37de790fe309a26cbb90b651227416d17fd5d6fe6

Contents?: true

Size: 1.13 KB

Versions: 4

Compression:

Stored size: 1.13 KB

Contents

require 'genspec'
require 'generators/curly/controller/controller_generator'

describe Curly::Generators::ControllerGenerator do
  with_args "animals/cows", "foo"

  it "generates a Curly template for each action" do
    subject.should generate("app/views/animals/cows/foo.html.curly") {|content|
      expected_content = "<h1>Animals::Cows#foo</h1>\n" +
        "<p>Find me in app/views/animals/cows/foo.html.curly</p>\n"

      content.should == expected_content
    }
  end

  it "generates a Curly presenter for each action" do
    subject.should generate("app/presenters/animals/cows/foo_presenter.rb") {|content|
      expected_content = (<<-RUBY).gsub(/^\s{8}/, "")
        class Animals::Cows::FooPresenter < Curly::Presenter
          # If you need to assign variables to the presenter, you can use the
          # `presents` method.
          #
          #   presents :foo, :bar
          #
          # Any public method defined in a presenter class will be available
          # to the Curly template as a variable. Consider making these methods
          # idempotent.
        end
      RUBY

      content.should == expected_content
    }
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
curly-templates-2.5.0 spec/generators/controller_generator_spec.rb
curly-templates-2.4.1 spec/generators/controller_generator_spec.rb
curly-templates-2.4.0 spec/generators/controller_generator_spec.rb
curly-templates-2.3.2 spec/generators/controller_generator_spec.rb