Sha256: 85be560365a65d710f70bec0ad2a3d8d93968a6bd10e3cccc93eb0a662af3abc
Contents?: true
Size: 1.41 KB
Versions: 3
Compression:
Stored size: 1.41 KB
Contents
# encoding: UTF-8 require 'spec_helper' require 'it' describe It::Link, '.new' do it "should accept a String as frist param" do expect { It::Link.new("http://www.rubyonrails.org/") }.not_to raise_error end it "should accept a Hash as first param" do expect { It::Link.new({:controller => "articles", :action => "index"}) }.not_to raise_error end it "should raise a TypeError if the first param is an Integer" do expect { It::Link.new(1) }.to raise_error(TypeError) end it "should accept options as a Hash" do expect { It::Link.new("http://www.rubyonrails.org/", {:id => "identity", :class => "classy"}) }.not_to raise_error end it "should raise a TypeError, if the options are a String" do expect { It::Link.new("http://www.rubyonrails.org/", "classy") }.to raise_error(TypeError) end it "should raise ArgumentError, if called with three params" do expect { It::Link.new("http://www.rubyonrails.org/", {}, :blubb) }.to raise_error(ArgumentError) end end describe It::Link, '#tag_name' do it "should always return a" do It::Link.new("http://www.rubyonrails.org/").tag_name.should == :a end end describe It::Link, '#process' do it "should return a link with the options set and the content as label" do It::Link.new("http://www.rubyonrails.org", :target => "_blank").process("Rails").should == '<a href="http://www.rubyonrails.org" target="_blank">Rails</a>' end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
it-0.2.3 | spec/it/link_spec.rb |
it-0.2.1 | spec/it/link_spec.rb |
it-0.2.0 | spec/it/link_spec.rb |