public
Description: Your favorite URL-shortening service in all of Ruby land
Homepage: http://rubyurl.com
Clone URL: git://github.com/robbyrussell/rubyurl.git
Search Repo:
commit  7da8eaa3794abb77343eabbe338693f57eecc683
tree    c84fed38522b8c24353f96002001d89fe1bf85d4
parent  50e28adae1c5382cbf80b1456afecaacfa712505
rubyurl / spec / views / links / index_view_spec.rb
100644 39 lines (31 sloc) 1.109 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
require File.dirname(__FILE__) + '/../../spec_helper'
 
describe "links/index" do
  before(:each) do
    render 'links/index'
  end
  
  it "should display Create a RubyURL in a h1 tag" do
    response.should have_tag('h1', 'Create a RubyURL')
  end
  
  it "should display a text input field for the user to paste their url in" do
    response.should have_tag('input#link_website_url')
  end
end
 
describe "links/show" do
 
  before(:each) do
    @link = mock_model(Link)
    @link.stub!(:permalink).and_return('http://localhost:3000/x093')
    @link.stub!(:website_url).and_return('http://rubyurl.com/')
    assigns[:link] = @link
    render 'links/show'
  end
  
  it "should display Here is your RubyURL in a h1 tag" do
    response.should have_tag('h1', 'Here is your RubyURL')
  end
    
  it "should display a link for the user to copy" do
    response.should have_tag('div#url')
    response.should have_tag('a', 'http://localhost:3000/x093')
  end
  
  it "should display the correct number of characters for the original URL (16)" do
    response.should have_tag('dd', '19 characters')
  end
end