Sha256: 099058cd9294f92b552336c4b9f68cdfb85dba186341a0250c92491c17abaa33

Contents?: true

Size: 1.03 KB

Versions: 3

Compression:

Stored size: 1.03 KB

Contents

require 'spec_helper'

describe 'view API - symbols' do
  use_helpers :view

  def simple_path_expr str
    /#{Regexp.escape(str)}/    
  end

  before :each do              
    Rails3::Assist::Directory.rails_root = fixtures_dir
  end

  it "should find view file using args" do
    simple_path = 'views/person/show.erb.html'
    admin_path = 'views/person/admin/show.erb.html'
    
    person_show = simple_path_expr(simple_path)
    person_admin_show = simple_path_expr(admin_path)
    
    view_file(:person => :show).should match person_show
    view_file(:person => 'show').should match person_show
    view_file('person/admin/' => 'show').should match person_admin_show

    view_file(:person, :show).should match person_show
    view_file('person/admin', :show).should match person_admin_show
    view_file(:show, :folder => 'person').should match person_show
    view_file(:folder => 'person', :action => :show).should match person_show
    view_file(:folder => 'person', :action => :show, :type => :erb).should match person_show
  end 
end    

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rails3_artifactor-0.3.1 spec/rails3_artifactor/artifact/crud/view_file_spec.rb
rails3_artifactor-0.3.0 spec/rails3_artifactor/artifact/crud/view_file_spec.rb
rails3_artifactor-0.2.8 spec/rails3_artifactor/artifact/crud/view_file_spec.rb