Sha256: 8c57cfedf19c7dec4aa4504accdabb52874170362e5889450bd603e14f57b7ac

Contents?: true

Size: 619 Bytes

Versions: 5

Compression:

Stored size: 619 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

describe Erubis::OnlyRuby do
  subject {
    content = <<-EOF
    <h1>Title</h1>
    <% if current_user %>
      <%= link_to 'account', edit_user_path(current_user) %>
      <%= "Hello \#{current_user.email}" %>
    <% else %>
      Not logged in
    <% end %>
    EOF
    Erubis::OnlyRuby.new(content).src
  }

  it { should_not include('h1') }
  it { should_not include('Title') }
  it { should_not include('Not logged in') }
  it { should include('current_user') }
  it { should include('if') }
  it { should include('else') }
  it { should include('end') }
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rails_best_practices-1.20.0 spec/rails_best_practices/core_ext/erubis_spec.rb
rails_best_practices-1.19.5 spec/rails_best_practices/core_ext/erubis_spec.rb
rails_best_practices-1.19.4 spec/rails_best_practices/core_ext/erubis_spec.rb
rails_best_practices-1.19.3 spec/rails_best_practices/core_ext/erubis_spec.rb
rails_best_practices-1.19.2 spec/rails_best_practices/core_ext/erubis_spec.rb