Sha256: 121ed8811e7febb080ce0a5e2df595367313cf9de25de99740804fc4d1051405

Contents?: true

Size: 1.7 KB

Versions: 5

Compression:

Stored size: 1.7 KB

Contents

require 'spec_helper'

describe RailsTemplater::Templater do

  let(:group) { 'sample' }

  its(:fixture_replacement) { should be_kind_of(RailsTemplater::FixtureReplacement) }
  its(:javascript_framework) { should be_kind_of(RailsTemplater::JavaScriptFramework) }
  its(:orm) { should be_kind_of(RailsTemplater::Orm) }
  its(:testing_framework) { should be_kind_of(RailsTemplater::TestingFramework) }

  it "generates a recipe path based on a name" do
    subject.recipe("mongoid").should == File.expand_path('recipes/mongoid.rb', TEMPLATE_FRAMEWORK_PATH)
  end

  it "generates a snippet path" do
    subject.snippet_path("cucumber").should == File.expand_path('snippets/cucumber', TEMPLATE_FRAMEWORK_PATH)
  end

  it "generates a template path" do
    subject.template_path("haml").should == File.expand_path('templates/haml', TEMPLATE_FRAMEWORK_PATH)
  end

  describe "#load_snippet" do

    let(:snippet_name) { 'sample_snippet' }

    before(:each) do
      subject.stub(:snippet_path) { FIXTURE_PATH }
    end

    it "loads a snippet" do
      subject.load_snippet(snippet_name, group).should == load_fixture(snippet_name)
    end

  end

  describe "#load_template" do

    let(:template_name) { 'sample_template.rb' }

    before(:each) do
      subject.stub(:template_path) { FIXTURE_PATH }
    end

    it "loads a template" do
      subject.load_template(template_name, group).should == load_fixture(template_name)
    end

  end

  describe "#post_bundler" do

    it "adds blocks to post_bundler_strategies" do
      subject.post_bundler do
        "Hi"
      end
      subject.post_bundler_strategies.should have(1).item
      result = subject.post_bundler_strategies.first.call
      result.should == 'Hi'
    end

  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rails_templater-0.3.0 spec/rails_templater/templater_spec.rb
rails_templater-0.2.1 spec/rails_templater/templater_spec.rb
rails_templater-0.2.0 spec/rails_templater/templater_spec.rb
rails_templater-0.1.2 spec/rails_templater/templater_spec.rb
rails_templater-0.1.1 spec/rails_templater/templater_spec.rb