On 12/12/2011 04:37 PM, tsedovic(a)redhat.com wrote:
> From: Tomas Sedovic<tomas(a)sedovic.cz>
>
>
https://bugzilla.redhat.com/show_bug.cgi?id=761134
> ---
> src/app/controllers/images_controller.rb | 4 ++++
> src/config/locales/en.yml | 1 +
> src/features/image.feature | 29 ++++++++++++++++++-----------
> 3 files changed, 23 insertions(+), 11 deletions(-)
>
> diff --git a/src/app/controllers/images_controller.rb
> b/src/app/controllers/images_controller.rb
> index 66acd6d..5cf0994 100644
> --- a/src/app/controllers/images_controller.rb
> +++ b/src/app/controllers/images_controller.rb
> @@ -109,6 +109,10 @@ class ImagesController< ApplicationController
> else
> file = params[:image_file]
> xml_source = file&& file.read
> + if xml_source.blank?
"blank?" covers also the case when a user uploads a file which is empty.
Then the user gets this message which could be confusing. So "unless
xml_source" would be better maybe.
> + flash.now[:error] = t('images.flash.error.no_file')
> + render :new and return
> + end
> end
>
> begin
> diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
> index 1786fa2..99050d5 100644
> --- a/src/config/locales/en.yml
> +++ b/src/config/locales/en.yml
> @@ -718,6 +718,7 @@ en:
> not_found: Image not found
> error:
> invalid_url: Could not load the provided URL
> + no_file: You must specify the template XML file
> new:
> new_image: New Image
> description:
> diff --git a/src/features/image.feature b/src/features/image.feature
> index ade5ab2..7cc4a24 100644
> --- a/src/features/image.feature
> +++ b/src/features/image.feature
> @@ -1,18 +1,25 @@
> +Feature: Manage Images
> + In order to manage my cloud infrastructure
> + As a user
> + I want to manage instances
> +
> + Background:
> + Given I am an authorised user
> + And I am logged in
> +
> + Scenario: Uploading a template without specifying the file
> + Given there is a pool family named "testpoolfamily"
> + And I am on the pool families page
> + And I follow "New Image"
> + Then I should be on the new image page
> + When I fill in "name" with "my template"
> + And I press "file_button"
> + Then I should see "You must specify the template XML file"
> +
> #
> # FIXME - This test is failing, but fixing it requires fixing a larger
> bug: we don't
> # use VCR the way we think we do when interacting with iwhd... That's
> a large can of worms.
> #
> -
> -#Feature: Manage Images
> -# In order to manage my cloud infrastructure
> -# As a user
> -# I want to manage instances
> -
> -# Background:
> -# Given I am an authorised user
> -# And I am logged in
> -
> -
> # Scenario: Show image details
> # Given there is an image
> # And I am on the images page
ACK, nit inline
Thanks, fixed & pushed.
Thomas
--
No trees were killed to send this message, but a large number of
electrons were terribly inconvenienced.