aboutsummaryrefslogtreecommitdiffstats
path: root/spec/features/companies_spec.rb
blob: bcf73b63133ede9ee7c89a39c9d80640e86eada9 (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
# -*- coding: utf-8 -*-
require 'spec_helper'

describe "Companies", :type => :feature do
  login_user

  let!(:companies) { Array.new(2) { create :company } }
  subject { companies.first }

  describe "list" do
    it "display companies" do
      puts referential.inspect
      visit referential_companies_path(referential)
      expect(page).to have_content(companies.first.name)
      expect(page).to have_content(companies.last.name)
    end
    
  end 

  describe "show" do      
    it "display company" do
      visit referential_companies_path(referential)
      click_link "#{companies.first.name}"
      expect(page).to have_content(companies.first.name)
    end
    
  end

  describe "new" do      
    it "creates company and return to show" do
      visit referential_companies_path(referential)
      click_link "Ajouter un transporteur"
      fill_in "company_name", :with => "Company 1"
      fill_in "Numéro d'enregistrement", :with => "test-1"
      fill_in "Identifiant Neptune", :with => "test:Company:1"        
      click_button("Créer transporteur")
      expect(page).to have_content("Company 1")
    end
  end

  describe "edit and return to show" do      
    it "edit company" do
      visit referential_company_path(referential, subject)
      click_link "Modifier ce transporteur"
      fill_in "Nom", :with => "Company Modified"
      fill_in "Numéro d'enregistrement", :with => "test-1"
      click_button("Modifier transporteur")
      expect(page).to have_content("Company Modified")
    end
  end

end