diff options
| author | Luc Donnet | 2015-01-05 14:56:12 +0100 | 
|---|---|---|
| committer | Luc Donnet | 2015-01-05 14:56:12 +0100 | 
| commit | 3bc6d313bebdc1f03e4021aabbc774a0cd97d938 (patch) | |
| tree | ac5b8c6d8309012136606d9fd9b9a00290f486a8 /spec/features/referentials_spec.rb | |
| parent | e632a4634b1762f4c73d11f1e5b127de9832a1ff (diff) | |
| download | chouette-core-3bc6d313bebdc1f03e4021aabbc774a0cd97d938.tar.bz2 | |
Initialize rails 4 migration
Diffstat (limited to 'spec/features/referentials_spec.rb')
| -rw-r--r-- | spec/features/referentials_spec.rb | 62 | 
1 files changed, 62 insertions, 0 deletions
| diff --git a/spec/features/referentials_spec.rb b/spec/features/referentials_spec.rb new file mode 100644 index 000000000..d4a21479f --- /dev/null +++ b/spec/features/referentials_spec.rb @@ -0,0 +1,62 @@ +# -*- coding: utf-8 -*- +require 'spec_helper' + +describe "Referentials", :type => :feature do +  login_user + +  describe "index" do + +    it "should support no referential" do +      visit referentials_path +      expect(page).to have_content("Espaces de Données") +    end + +    context "when several referentials exist" do + +      def retrieve_referential_by_slug( slug) +        @user.organisation.referentials.find_by_slug(slug) ||  +          create(:referential, :slug => slug, :name => slug, :organisation => @user.organisation) +      end +                                                 +      let!(:referentials) { [ retrieve_referential_by_slug("aa"), +                              retrieve_referential_by_slug("bb")] }   + +      it "should show n referentials" do +        visit referentials_path +        expect(page).to have_content(referentials.first.name) +        expect(page).to have_content(referentials.last.name) +      end +       +    end + +  end +   +  describe "create" do +     +    it "should" do +      visit new_referential_path +      fill_in "Nom", :with => "Test" +      fill_in "Code", :with => "test" +      fill_in "Point haut/droite de l'emprise par défaut", :with => "0.0, 0.0" +      fill_in "Point bas/gauche de l'emprise par défaut", :with => "1.0, 1.0" +      click_button "Créer Espace de Données" + +      expect(Referential.where(:name => "Test")).not_to be_nil +      # CREATE SCHEMA +    end + +  end + +  describe "destroy" do +    let(:referential) {  create(:referential, :organisation => @user.organisation) }  + +    it "should remove referential" do +      pending "Unauthorized DELETE (ticket #14)" +      visit referential_path(referential) +      click_link "Supprimer" +      expect(Referential.where(:slug => referential.slug)).to be_blank +    end + +  end +   +end | 
