Sha256: 4eaab98f8d15f61367f84a6d547e02367175261309ded9782a82db885307700e

Contents?: true

Size: 1021 Bytes

Versions: 1

Compression:

Stored size: 1021 Bytes

Contents

require 'spec_helper'

describe 'view API - symbols' do
  use_helpers :view

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

  before :each do
    RailsAssist::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

1 entries across 1 versions & 1 rubygems

Version Path
rails_artifactor-0.5.1 spec/rails_artifactor/artifact/crud/view_file_spec.rb