Sha256: bc689dd4100414ca196464e4648dccd3fbee64dbdd9826e4d26489f69e7e258b

Contents?: true

Size: 1.19 KB

Versions: 6

Compression:

Stored size: 1.19 KB

Contents

# coding: UTF-8
require 'spec_helper'

class Snipp::Markup::Microdata::Spec

  GEO = [
    { id: "#case-A-1", latitude: 38.5323, longitude: 77.0040 },
  ]

end

describe Snipp::Markup::Microdata do

  before do
    Snipp::Hooks.init
    visit "/geo"
  end

  let(:itemtype) { "http://data-vocabulary.org/Geo" }

  shared_examples_for 'defined the latitude and longitude' do |e|
    it { expect(page).to have_selector("[itemprop=\"latitude\"][content=\"#{e[:latitude]}\"]"   ,count: 1) }
    it { expect(page).to have_selector("[itemprop=\"longitude\"][content=\"#{e[:longitude]}\"]" ,count: 1) }
  end

  describe "geo" do

    Snipp::Markup::Microdata::Spec::GEO.each do |e|
      context e[:id] do
        it "should have a `span[itemscope]` tag" do
          within(e[:id]) { expect(page).to have_selector("span[itemtype=\"#{itemtype}\"][itemscope]", count: 1) }
        end
        [:latitude, :longitude].each do |arg|
          it "should have a `itemprop` attribute that equals `#{arg}`" do
            within(e[:id]) { expect(page).to have_selector("[itemprop=\"#{arg}\"]", count: 1) }
          end
        end
        it_should_behave_like 'defined the latitude and longitude', e
      end
    end

  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
snipp-0.1.4 spec/snipp/markups/microdata/geo_spec.rb
snipp-0.1.3 spec/snipp/markups/microdata/geo_spec.rb
snipp-0.1.2 spec/snipp/markups/microdata/geo_spec.rb
snipp-0.1.1 spec/snipp/markups/microdata/geo_spec.rb
snipp-0.1.0 spec/snipp/markups/microdata/geo_spec.rb
snipp-0.0.6 spec/snipp/markups/microdata/geo_spec.rb