blob: 0c8b06c0f108aee5ceb1deb2438006739b256914 (
plain)
| 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
 | # -*- coding: utf-8 -*-
require 'spec_helper'
describe "ConnectionLinks" do
  login_user
  let!(:referential) { create(:referential).switch }
  let!(:connection_links) { referential; Array.new(2) { create(:connection_link) } }
  subject { connection_links.first }
  describe "list" do
    it "display connection_links" do
      visit referential_connection_links_path(referential)
      page.should have_content(connection_links.first.name)
      page.should have_content(connection_links.last.name)
    end
    
  end 
  describe "show" do      
    it "display connection_link" do
      visit referential_connection_links_path(referential)
      click_link "#{connection_links.first.name}"
      page.should have_content(connection_links.first.name)
    end
    
    it "display map" do
      pending ": map not yet implemented"
      subject.stub(:stop_areas).and_return(Array.new(2) { Factory(:stop_area) })
      visit referential_connection_links_path(referential)
      click_link "#{connection_links.first.name}"
      page.should have_selector("#map", :class => 'connection_link')
    end
    
  end
  describe "new" do     
    it "creates connection_link and return to show" do
      visit referential_connection_links_path(referential)
      click_link "Ajouter une correspondance"
      fill_in "Nom", :with => "ConnectionLink 1"
      fill_in "Identifiant Neptune", :with => "test:ConnectionLink:1"        
      click_button("Créer Correspondance")
      page.should have_content("ConnectionLink 1")
    end
  end
  describe "edit and return to show" do      
    it "edit connection_link" do
      visit referential_connection_link_path(referential, subject)
      click_link "Modifier cette correspondance"
      fill_in "Nom", :with => "ConnectionLink Modified"
      click_button("Modifier Correspondance")
      page.should have_content("ConnectionLink Modified")
    end
  end
end
 |