spec/page_spec.rb in nesta-0.10.0 vs spec/page_spec.rb in nesta-0.11.0
- old
+ new
@@ -108,18 +108,18 @@
include RequestSpecHelper
it "should not include GA JavaScript by default" do
stub_configuration
get "/"
- assert_not_selector "script", content: "'_setAccount', 'UA-1234'"
+ assert_not_selector "script", content: "ga('create', 'UA-1234'"
end
it "should include GA JavaScript if configured" do
stub_config_key('google_analytics_code', 'UA-1234', rack_env: true)
stub_configuration
get "/"
- assert_selector 'script', content: "'_setAccount', 'UA-1234'"
+ assert_selector 'script', content: "ga('create', 'UA-1234'"
end
end
describe "The home page" do
include ModelFactory
@@ -446,9 +446,25 @@
it "should display the article heading" do
do_get
assert_selector 'h1', content: @articles_heading
end
+ end
+ end
+
+ describe "with associated categories" do
+ it "should link to the first assigned category in breadcrumb" do
+ category1 = create_category(path: 'category1', heading: 'Category 1')
+ create_category(path: 'category2', heading: 'Category 2')
+ @category = create_page(
+ path: "a-page",
+ heading: "A Page",
+ metadata: { 'categories' => 'category1, category2' }
+ )
+ do_get
+ href = category1.abspath
+ link_text = category1.link_text
+ assert_selector "nav.breadcrumb a[href='#{href}']", content: link_text
end
end
end
describe "A Haml page" do