Sha256: 79e35ac38cc2d54b9d55208519963b2a34bf9a22af3c9b8755c11b41e33c162d

Contents?: true

Size: 1.71 KB

Versions: 17

Compression:

Stored size: 1.71 KB

Contents

require File.expand_path(File.dirname(__FILE__)+'/spec_helper')

include Restfully
describe Link do
  before do
    @uri = URI.parse('/x/y/z')
  end
  it "should have a rel reader" do
    link = Link.new
    link.should_not respond_to(:rel=)
    link.should respond_to(:rel)
  end
  it "should have a href reader" do
    link = Link.new
    link.should_not respond_to(:href=)
    link.should respond_to(:href)
  end
  it "should have a title reader" do
    link = Link.new
    link.should_not respond_to(:title=)
    link.should respond_to(:title)
  end
  it "should have a errors reader" do
    link = Link.new
    link.should_not respond_to(:errors=)
    link.should respond_to(:errors)
  end
  it "should respond to valid?" do
    link = Link.new
    link.should respond_to(:valid?)    
  end
  it "should respond to resolved?" do
    link = Link.new("href" => @uri)
    link.should respond_to(:resolved?)
  end
  it "should respond to resolvable?" do
    link = Link.new
    link.should respond_to(:resolvable?)
  end
  it "by default, should not be resolvable" do
    link = Link.new
    link.should_not be_resolvable
  end
  it "by default, should not be resolved" do    
    link = Link.new
    link.should_not be_resolved
  end
  it "should be valid even if the href is ''" do
    link = Link.new 'rel' => 'collection', 'title' => 'my collection'
    link.should be_valid
    link.href.should == URI.parse("")
  end
  it "should not be valid if there is no rel" do
    link = Link.new 'href' => '/', 'title' => 'my collection'
    link.should_not be_valid
  end
  it "should not be valid if the rel is valid but requires a title that is not given" do
    link = Link.new 'rel' => 'collection', 'href' => '/'
    link.should_not be_valid
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
restfully-0.6.3 spec/link_spec.rb
restfully-0.6.2 spec/link_spec.rb
restfully-0.6.1 spec/link_spec.rb
restfully-0.6.0 spec/link_spec.rb
restfully-0.5.10 spec/link_spec.rb
restfully-0.5.9 spec/link_spec.rb
restfully-0.5.8 spec/link_spec.rb
restfully-0.5.7 spec/link_spec.rb
restfully-0.5.6 spec/link_spec.rb
restfully-0.5.5 spec/link_spec.rb
restfully-0.5.4 spec/link_spec.rb
restfully-0.5.3 spec/link_spec.rb
restfully-0.5.2 spec/link_spec.rb
restfully-0.5.1 spec/link_spec.rb
restfully-0.5.0 spec/link_spec.rb
restfully-0.4.1 spec/link_spec.rb
restfully-0.4.0 spec/link_spec.rb