Sha256: 2e4fee7ef96bf38dc9fd452046bcc1264edda9adafbb9fae50d0c19c894fc711

Contents?: true

Size: 1.44 KB

Versions: 3

Compression:

Stored size: 1.44 KB

Contents

require 'spec_helper'

CLASS = Rails3::Assist::Artifact::View

class ArtDir
  include CLASS
end

describe Rails3::Assist::Artifact::View::FileName do
  # use_orm :active_record

  before do
    Rails3::Assist::Directory.rails_root = File.dirname (__FILE__)
    @test = ArtDir.new
  end

  describe '#view_file_name' do
    it "should return the file name for the persons/show view with default action" do      
      CLASS.view_file_name(:person, :show).should match 'views/person/show'.to_regexp
    end

    it "should return the file name for the persons/show view with template type" do      
      CLASS.view_file_name(:person, :show, :type => :erb).should match 'views/person/show'.to_regexp
    end
    
    it "should return the file name for the persons/show view using hash" do      
      CLASS.view_file_name(:folder => :person, :action => :show, :type => 'erb.hml').should match 'views/person/show'.to_regexp
    end
    
    it "should return the file name for the persons/show view with root path" do      
      CLASS.view_file_name(:folder => :person, :action => :show, :type => :erb, :root_path => Rails3::Assist::Directory.rails_root).should match 'views/person/show'.to_regexp
    end        

    it "should return the file name for the persons/show view with root path" do      
      CLASS.view_file_name(:folder => :person, :action => :show, :type => :erb, :views_path => 'my/views').should match 'views/person/show'.to_regexp
    end        
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rails3_artifactor-0.4.0 spec/rails3_artifactor/artifact/file_name/view_spec.rb
rails3_artifactor-0.3.2 spec/rails3_artifactor/artifact/file_name/view_spec.rb
rails3_artifactor-0.3.1 spec/rails3_artifactor/artifact/file_name/view_spec.rb