<commit_before>require 'spec_helper'
require 'fluent_helpers/themes/inspinia'
require 'fluent_helpers/themes/bootstrap'

describe FluentHelpers::Helpers::Base do
  let(:person) { Struct.new :name, :birthday, :country }
  let(:template) { TemplateStub.new.tap { |t|
    t.extend FluentHelpers::Helpers
  } }

  before do
    allow(template).to receive(:url_for).and_return('/awesome/')
  end

  example 'link with classes' do
    html = FluentHelpers::Helpers::Link.new template, ->(b) { }
    html.classes 'css-class'
    expect(html.to_s).to have_tag('a.css-class')
  end

  example 'link with id' do
    html = FluentHelpers::Helpers::Link.new template, ->(b) { }
    html.classes 'awesomeId'
    expect(html.to_s).to have_tag('a.awesomeId')
  end

  example 'link with data' do
    html = FluentHelpers::Helpers::Link.new template, ->(b) { }
    html.data({ whoop: 'awesomeData' })
    expect(html.to_s).to have_tag('a', with: { 'data-whoop': 'awesomeData' })
  end

  example 'link with inline style' do
    html = FluentHelpers::Helpers::Link.new template, ->(b) { }
    html.style({ color: '#000' })
    expect(html.to_s).to have_tag('a')
    expect(html.to_s).to match /style="color: #000;"/
  end



end<commit_msg>specs for correct assigments in base helper class<commit_after>require 'spec_helper'
require 'fluent_helpers/themes/inspinia'
require 'fluent_helpers/themes/bootstrap'

describe FluentHelpers::Helpers::Base do
  let(:template) { TemplateStub.new }

  example 'element with classes' do
    html = described_class.new template
    expect {
      html.classes('css-class')
    }.to change {
      html.instance_eval("@classes")
    }.from([]).to(["css-class"])
  end

  example 'link with id' do
    html = described_class.new template
    expect {
      html.id 'awesomeId'
    }.to change {
      html.instance_eval("@id")
    }.from(nil).to('awesomeId')
  end

  example 'link with data' do
    html = described_class.new template
    expect {
      html.data({ whoop: 'awesomeData' })
    }.to change {
      html.instance_eval("@options")
    }.from({}).to({ 'data-whoop' => 'awesomeData'})
  end

  example 'link with inline style' do
    html = described_class.new template
    expect {
      html.style({ color: '#000' })
    }.to change {
      html.instance_eval("@options")
    }.from({}).to({ style: 'color: #000;' })
  end
end
{'fraction_non_alphanumeric': 0.15218312844425605, 'fraction_numerical': 0.005086901229334464, 'mean_word_length': 3.5124282982791586, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6406020', 'n_tokens_mistral': 821, 'n_tokens_neox': 805, 'n_words': 180}