diff options
| author | Luc Donnet | 2014-06-30 16:00:14 +0200 |
|---|---|---|
| committer | Luc Donnet | 2014-06-30 16:00:14 +0200 |
| commit | bf05e79d81b5fa9f53154317ba7049661ab732fb (patch) | |
| tree | e8e2213516aebcc0873ea9696acd36570e676cd9 /spec/requests | |
| parent | 89dd167379ae6ff6420be959f31ed5b1755cbaca (diff) | |
| download | chouette-core-bf05e79d81b5fa9f53154317ba7049661ab732fb.tar.bz2 | |
Add stop areas import Refs #0026832
Diffstat (limited to 'spec/requests')
| -rw-r--r-- | spec/requests/stop_area_imports_spec.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/requests/stop_area_imports_spec.rb b/spec/requests/stop_area_imports_spec.rb new file mode 100644 index 000000000..c0da1edac --- /dev/null +++ b/spec/requests/stop_area_imports_spec.rb @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +require 'spec_helper' + +describe "StopAreaImports" do + login_user + + let!(:line) { create :line } + let!(:valid_file_path) { Rails.root + "spec/fixtures/stop_area_import_valid.csv" } + let!(:invalid_file_path) { Rails.root + "spec/fixtures/stop_area_import_invalid.csv" } + + describe "new" do + it "should create stop areas and return to stop areas index page" do + visit new_referential_stop_area_import_path(referential) + attach_file('Fichier', valid_file_path) + click_button "Lancer l'import" + expect(page).to have_content(I18n.t("stop_area_imports.new.success")) + expect(page).to have_content("StopArea1") + end + + it "should return error messages when file is invalid" do + visit new_referential_stop_area_import_path(referential) + attach_file('Fichier', invalid_file_path) + click_button "Lancer l'import" + expect(page).to have_content(I18n.t("stop_area_imports.errors.import_aborted")) + end + + it "should return error message when file missing on upload" do + visit new_referential_stop_area_import_path(referential) + click_button "Lancer l'import" + expect(page).to have_content(I18n.t("stop_area_imports.errors.import_aborted")) + end + end + +end |
