Sha256: 644b6353931327ec6af97277a0f3f1546f348d8bddda09d9b15325beb9bd33a0

Contents?: true

Size: 677 Bytes

Versions: 7

Compression:

Stored size: 677 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

describe Erubis::OnlyRuby do
  subject do
    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
    described_class.new(content).src
  end

  it { is_expected.not_to include('h1') }
  it { is_expected.not_to include('Title') }
  it { is_expected.not_to include('Not logged in') }
  it { is_expected.to include('current_user') }
  it { is_expected.to include('if') }
  it { is_expected.to include('else') }
  it { is_expected.to include('end') }
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rails_best_practices-1.23.2 spec/rails_best_practices/core_ext/erubis_spec.rb
rails_best_practices-1.23.1 spec/rails_best_practices/core_ext/erubis_spec.rb
rails_best_practices-1.23.0 spec/rails_best_practices/core_ext/erubis_spec.rb
rails_best_practices-1.22.1 spec/rails_best_practices/core_ext/erubis_spec.rb
rails_best_practices-1.22.0 spec/rails_best_practices/core_ext/erubis_spec.rb
rails_best_practices-1.21.0 spec/rails_best_practices/core_ext/erubis_spec.rb
rails_best_practices-1.20.1 spec/rails_best_practices/core_ext/erubis_spec.rb