Sha256: cce20df8aa9b2f3245bb5d2a9f771f3ae08002b5f96cbaeb102645989898427c

Contents?: true

Size: 1.12 KB

Versions: 7

Compression:

Stored size: 1.12 KB

Contents

# frozen_string_literal: true

require 'rails_helper'

describe Cookbook::ApplicationHelper do
  describe '#cookbook' do
    before do
      FactoryBot.create_list(:recipe, 5)
      FactoryBot.create_list(:how_to, 5)

      FactoryBot.create_list(:ingredient, 5)
      FactoryBot.create_list(:tool, 5)
      FactoryBot.create_list(:supply, 5)

      FactoryBot.create_list(:use, 25)
    end
    before do
      allow(view).to receive(:current_ability).and_return(Ability.new(nil))
    end

    context 'returns cookbook_uses_of' do
      let(:ingredient) { Ingredient.first }
      subject { helper.cookbook_uses_of(ingredient) }
      it do
        should have_tag('ul', with: { class: 'uses_of' }) do
          with_tag(
            'li',
            with: { class: 'use_of' }
          )
        end
      end
    end

    context 'returns cookbook_used_in' do
      let(:recipe) { Recipe.first }
      subject { helper.cookbook_used_in(recipe) }
      it do
        should have_tag('ul', with: { class: 'used_in' }) do
          with_tag(
            'li',
            with: { class: 'use_in' }
          )
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
cookbook-0.1.6 spec/helpers/cookbook/application_helper_spec.rb
cookbook-0.1.5 spec/helpers/cookbook/application_helper_spec.rb
cookbook-0.1.4 spec/helpers/cookbook/application_helper_spec.rb
cookbook-0.1.3 spec/helpers/cookbook/application_helper_spec.rb
cookbook-0.1.2 spec/helpers/cookbook/application_helper_spec.rb
cookbook-0.1.1 spec/helpers/cookbook/application_helper_spec.rb
cookbook-0.1.0 spec/helpers/cookbook/application_helper_spec.rb