Sha256: f3cbbdbb53c1723ba52ceafdd4fea7bc66af597a0fc5c1a6f9d08ec46ad0e290

Contents?: true

Size: 1.88 KB

Versions: 63

Compression:

Stored size: 1.88 KB

Contents

require 'spec_helper'

describe "A visitor dereferences a uri then asks for a format" do


  context "in our domain" do
    before do
      @resource = FactoryGirl.create(:yuri_unicorn_resource)
      visit @resource.uri.to_s
      click_link 'RDF/XML'
    end

    it "should show the right serlialisation" do
      page.source.should == @resource.to_rdf
    end
  end

  context "not in our domain" do
    before do
      @resource = FactoryGirl.create(:foreign_resource)
      visit "/resource?uri=#{@resource.uri.to_s}"
      click_link 'RDF/XML'
    end

    it "should show the right serlialisation" do
      page.source.should == @resource.to_rdf
    end

  end

end

describe "A visitor dereferences a uri then clicks on a link for another resource" do

  before do
    @yuri = FactoryGirl.create(:yuri_unicorn_resource)
    @boris = FactoryGirl.create(:boris_unicorn_resource)
    @foo_county = FactoryGirl.build(:foreign_resource)
  end

  context "in our domain" do
    before do
      visit @boris.uri.to_s
      click_link "Yuri The Unicorn" # via the knows association
    end

    it "should render the doc page for that uri" do
      page.current_url.should == @yuri.uri.to_s.sub(/\/id\//,'/doc/')
    end
  end

  context "not in our domain" do

    context "where we have data" do
      before do
        @foo_county.save!
        visit @boris.uri.to_s
        click_link @foo_county.label # via the resides-in association
      end
      it "should render the show page for that uri" do
        page.current_url.should == "http://pmdtest.dev/resource?uri=#{CGI.escape(@foo_county.uri.to_s)}"
      end
    end

    context "where we don't have data" do
      before do
        visit @boris.uri.to_s
        click_link @foo_county.uri.to_s # via the resides-in association
      end
      it "should redirect away" do
        page.current_url.should == @foo_county.uri.to_s
      end
    end
  end

end

Version data entries

63 entries across 63 versions & 1 rubygems

Version Path
publish_my_data-0.0.28 spec/features/uri_dereferencing_flow_spec.rb
publish_my_data-0.0.27 spec/features/uri_dereferencing_flow_spec.rb
publish_my_data-0.0.26 spec/features/uri_dereferencing_flow_spec.rb
publish_my_data-0.0.25 spec/features/uri_dereferencing_flow_spec.rb
publish_my_data-0.0.24 spec/features/uri_dereferencing_flow_spec.rb
publish_my_data-0.0.23 spec/features/uri_dereferencing_flow_spec.rb
publish_my_data-0.0.22 spec/features/uri_dereferencing_flow_spec.rb
publish_my_data-0.0.21 spec/features/uri_dereferencing_flow_spec.rb
publish_my_data-0.0.20 spec/features/uri_dereferencing_flow_spec.rb
publish_my_data-0.0.19 spec/features/uri_dereferencing_flow_spec.rb
publish_my_data-0.0.18 spec/features/uri_dereferencing_flow_spec.rb
publish_my_data-0.0.17 spec/features/uri_dereferencing_flow_spec.rb
publish_my_data-0.0.16 spec/features/uri_dereferencing_flow_spec.rb
publish_my_data-0.0.15 spec/features/uri_dereferencing_flow_spec.rb
publish_my_data-0.0.14 spec/features/uri_dereferencing_flow_spec.rb
publish_my_data-0.0.13 spec/features/uri_dereferencing_flow_spec.rb
publish_my_data-0.0.12 spec/features/uri_dereferencing_flow_spec.rb
publish_my_data-0.0.11 spec/features/uri_dereferencing_flow_spec.rb
publish_my_data-0.0.10 spec/features/uri_dereferencing_flow_spec.rb
publish_my_data-0.0.9 spec/features/uri_dereferencing_flow_spec.rb