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