Sha256: 455e8950861d9eb0983306436e0e9ef7adc735c7d963fa760d7dea3ae5f90696

Contents?: true

Size: 1.12 KB

Versions: 4

Compression:

Stored size: 1.12 KB

Contents

require 'spec_helper'

describe "Taxonomies" do
  
  describe "Show" do
    
    before (:each) do
      root_taxon = FactoryGirl.create(:taxon)
      @taxon = FactoryGirl.create(:taxon, :parent_id => root_taxon.id)
    end
  
    it "should not display sidebar FAQ w/o questions" do
      visit spree.nested_taxons_path(@taxon.permalink)
      page.should_not have_css("[data-hook='taxon_sidebar_faq']")
    end

    it "should display sidebar questions for current taxon" do
      @question = FactoryGirl.create(:question, :taxons => [@taxon])
      visit spree.nested_taxons_path(@taxon.permalink)
      page.should have_css("[data-hook='taxon_sidebar_faq']")
      page.should have_content(@question.question)
    end

    it "should only display first 3 questions in sidebar for current taxon" do
      @questions = (1..4).collect { FactoryGirl.create(:question, :taxons => [@taxon]) }
      visit spree.nested_taxons_path(@taxon.permalink)
      page.should have_css("[data-hook='taxon_sidebar_faq']")
      page.should have_content(@questions[0].question)
      page.should_not have_content(@questions[3].question)
    end
  
  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
spree_grid_faq-0.1.0 spec/requests/taxonomies_spec.rb
spree_grid_faq-0.0.9 spec/requests/taxonomies_spec.rb
spree_grid_faq-0.0.8 spec/requests/taxonomies_spec.rb
spree_grid_faq-0.0.7 spec/requests/taxonomies_spec.rb