Sha256: 48f6347567f0a396e145bffeb4ff231af0f5575b542bf2e0664449b08e88558d

Contents?: true

Size: 1.03 KB

Versions: 2

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.html.erb'
    admin_path = 'views/person/admin/show.html.erb'
    
    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

2 entries across 2 versions & 1 rubygems

Version Path
rails3_artifactor-0.4.0 spec/rails3_artifactor/artifact/crud/view_file_spec.rb
rails3_artifactor-0.3.2 spec/rails3_artifactor/artifact/crud/view_file_spec.rb