aboutsummaryrefslogtreecommitdiffstats
path: root/spec/features/access_points_spec.rb
blob: 21cfec85197a3ae5f52028a4c0b46b5fb0033d2a (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
59
60
61
62
63
# -*- coding: utf-8 -*-
require 'spec_helper'

describe "Access points", :type => :feature do
  login_user
  
  let!(:stop_area) { create(:stop_area) }
  let!(:access_points) { Array.new(2) { create(:access_point, :stop_area => stop_area) } }
  subject { access_points.first }
  
  describe "list" do

    it "displays a list of access points" do
      visit referential_stop_area_access_points_path(referential, stop_area)
      #save_and_open_page
      access_points.each do |ap|
        expect(page).to have_content(ap.name)
      end
    end

  end
  
  describe "show" do

    it "displays an access point" do
      access_points.each do |ap|
        visit referential_stop_area_path(referential, stop_area)
        click_link ap.name
        expect(page).to have_content(ap.name)
      end
    end
    
    it "displays a map" do
      access_points.each do |ap|
        visit referential_stop_area_path(referential, stop_area)
        click_link ap.name
        expect(page).to have_selector("#map.access_point")
      end
    end
    
  end
  
  describe "new" do
    it "creates an access point" do
      visit referential_stop_area_path(referential, stop_area)
      click_link I18n.t("access_points.actions.new")
      fill_in "access_point[name]", :with => "My Access Point Name"
      click_button(I18n.t('formtastic.create',model: I18n.t('activerecord.models.access_point.one')))
      expect(page).to have_content("My Access Point Name")
    end
  end
  
  describe "edit" do
    it "edits an acess point" do
      visit referential_stop_area_access_point_path(referential, stop_area, subject)
      click_link I18n.t("access_points.actions.edit")
      fill_in "access_point[name]", :with => "My New Access Point Name"
      click_button(I18n.t('formtastic.update',model: I18n.t('activerecord.models.access_point.one')))
      expect(page).to have_content("My New Access Point Name")
    end
  end
  
end