blob: 6f07fab4fdd86f7d12ca22d3be6cfdd04d7750e6 (
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
 | # -*- coding: utf-8 -*-
require 'spec_helper'
describe "Timebands", :type => :feature do
  login_user
  let!(:timebands) { Array.new(2) { create(:timeband) } }
  subject { timebands.first }
  describe "list" do
    it "display timebands" do
      visit referential_timebands_path(referential)
      expect(page).to have_content(timebands.first.name)
      expect(page).to have_content(timebands.last.name)
    end
  end
  describe "show" do
    it "display timeband" do
      visit referential_timebands_path(referential)
      click_link "#{timebands.first.name}"
      expect(page).to have_content(timebands.first.name)
    end
  end
  describe "new" do
    it "creates timeband and return to show" do
      visit referential_timebands_path(referential)
      click_link "Ajouter une plage horaire"
      fill_in "Titre", :with => "Timeband 1"
      select '10', from: 'timeband_start_time_4i'
      select '00', from: 'timeband_start_time_5i'
      select '11', from: 'timeband_end_time_4i'
      select '00', from: 'timeband_end_time_5i'
      click_button("Créer plage horaire")
      expect(page).to have_content("Timeband 1")
    end
  end
  describe "edit and return to show" do
    it "edit timeband" do
      visit referential_timeband_path(referential, subject)
      click_link "Modifier cette plage horaire"
      fill_in "Titre", :with => "Timeband Modified"
      click_button("Modifier plage horaire")
      expect(page).to have_content("Timeband Modified")
    end
  end
  describe "delete and return to list" do
    it "delete timeband" do
      visit referential_timebands_path(referential)
      page.all('.remove')[0].click
      expect(page).to_not have_content("Timeband Modified")
    end
  end
end
 |