ACK with 2 nits inline.

Thanks!



On 01/12/2011 11:44 AM, [email protected] wrote:
> From: Ladislav Martincik<[email protected]>
>
> This patch contains only basic deployable with property name.
> ---
>   .../image_factory/deployables_controller.rb        |   63 +++++++++++++++
>   src/app/models/deployable.rb                       |    2 +
>   src/app/views/image_factory/deployables/_form.haml |    7 ++
>   src/app/views/image_factory/deployables/_list.haml |   28 +++++++
>   .../image_factory/deployables/_properties.haml     |    4 +
>   src/app/views/image_factory/deployables/edit.haml  |    4 +
>   src/app/views/image_factory/deployables/index.haml |    3 +-
>   src/app/views/image_factory/deployables/new.haml   |    3 +
>   src/app/views/image_factory/deployables/show.haml  |    5 +
>   src/config/routes.rb                               |    3 +-
>   src/db/development_structure.sql                   |   83 
> ++++++++++++++++++++
>   .../migrate/20110112094108_create_deployables.rb   |   13 +++
>   src/features/deployable.feature                    |   50 ++++++++++++
>   src/features/step_definitions/deployable_steps.rb  |   20 +++++
>   src/features/support/paths.rb                      |    3 +
>   15 files changed, 289 insertions(+), 2 deletions(-)
>   create mode 100644 src/app/models/deployable.rb
>   create mode 100644 src/app/views/image_factory/deployables/_form.haml
>   create mode 100644 src/app/views/image_factory/deployables/_list.haml
>   create mode 100644 src/app/views/image_factory/deployables/_properties.haml
>   create mode 100644 src/app/views/image_factory/deployables/edit.haml
>   create mode 100644 src/app/views/image_factory/deployables/new.haml
>   create mode 100644 src/app/views/image_factory/deployables/show.haml
>   create mode 100644 src/db/development_structure.sql
>   create mode 100644 src/db/migrate/20110112094108_create_deployables.rb
>   create mode 100644 src/features/deployable.feature
>   create mode 100644 src/features/step_definitions/deployable_steps.rb
>
> diff --git a/src/app/controllers/image_factory/deployables_controller.rb 
> b/src/app/controllers/image_factory/deployables_controller.rb
> index efe521f..5b8210c 100644
> --- a/src/app/controllers/image_factory/deployables_controller.rb
> +++ b/src/app/controllers/image_factory/deployables_controller.rb
> @@ -1,6 +1,69 @@
>   class ImageFactory::DeployablesController<  ApplicationController
>     before_filter :require_user
> +  before_filter :load_deployables, :only =>  [:index, :show]
>
>     def index
>     end
> +
> +  def show
> +    @deployable = Deployable.find(params[:id])
> +    @url_params = params.clone
> +    @tab_captions = ['Properties']
> +    @details_tab = params[:details_tab].blank? ? 'properties' : 
> params[:details_tab]
> +    respond_to do |format|
> +      format.js do
> +        if @url_params.delete :details_pane
> +          render :partial =>  'layouts/details_pane' and return
> +        end
> +        render :partial =>  @details_tab and return
> +      end
> +      format.html { render :action =>  'show'}
> +    end
> +  end
> +
> +  def new
> +    @deployable = Deployable.new
> +  end
> +
> +  def create
> +    @deployable = Deployable.new(params[:deployable])
> +    if @deployable.save
> +      flash[:notice] = "Deployable added."
> +      redirect_to image_factory_deployable_url(@deployable)
> +    else
> +      render :action =>  :new
> +    end
> +  end
> +
> +  def edit
> +    @deployable = Deployable.find(params[:id])
> +  end
> +
> +  def update
> +    @deployable = Deployable.find(params[:id])
> +    if @deployable.update_attributes(params[:deployable])
> +      flash[:notice] = "Deployable updated."
> +      redirect_to image_factory_deployable_url(@deployable)
> +    else
> +      render :action =>  :edit
> +    end
> +  end
> +
> +  def multi_destroy
> +    Deployable.destroy(params[:deployables_selected])
> +    redirect_to image_factory_deployables_url
> +  end
> +
> +  protected
> +
> +  def load_deployables
> +    @header = [
> +      { :name =>  "Deployable name", :sort_attr =>  :name }
> +    ]
> +    @deployables = Deployable.paginate(:all,
> +      :page =>  params[:page] || 1,
> +      :order =>  (params[:order_field] || 'name') +' '+ (params[:order_dir] 
> || 'asc')
> +    )
> +    @url_params = params.clone
> +  end
>   end
> diff --git a/src/app/models/deployable.rb b/src/app/models/deployable.rb
> new file mode 100644
> index 0000000..f4891d8
> --- /dev/null
> +++ b/src/app/models/deployable.rb
> @@ -0,0 +1,2 @@
> +class Deployable<  ActiveRecord::Base
> +end
> diff --git a/src/app/views/image_factory/deployables/_form.haml 
> b/src/app/views/image_factory/deployables/_form.haml
> new file mode 100644
> index 0000000..cd08ebc
> --- /dev/null
> +++ b/src/app/views/image_factory/deployables/_form.haml
> @@ -0,0 +1,7 @@
> += form.error_messages
> +%fieldset.clear
> +  = form.label :name, t(:name), :class =>  "grid_3 alpha"


The `t(:name)` function points to a missing placeholder in the 
application localization dictionary.

Please add `  name: Name` to `config/locales/en.yml` to have the correct 
label displayed in the New and Edit forms.


> +  = form.text_field :name, :class =>  "grid_5"
> +%fieldset.clearfix
> +  = form.submit "Save",  :class =>  "submit formbutton"
> +  = link_to t(:cancel), image_factory_deployables_path, :class =>  'button 
> formbutton'
> diff --git a/src/app/views/image_factory/deployables/_list.haml 
> b/src/app/views/image_factory/deployables/_list.haml
> new file mode 100644
> index 0000000..e2933f0
> --- /dev/null
> +++ b/src/app/views/image_factory/deployables/_list.haml
> @@ -0,0 +1,28 @@
> +- form_tag do
> +  = link_to "Create", new_image_factory_deployable_url, :class =>  'button'
> +  = restful_submit_tag "Delete", 'destroy', 
> multi_destroy_image_factory_deployables_path, 'DELETE', :id =>  
> 'delete_button'
> +
> +  %table#deployables_table
> +    %thead
> +      %tr
> +        %th
> +        %th= link_to "Name", image_factory_deployables_url(:sort_by =>  
> "name")
> +    [email protected] do |deployable|
> +      %tr
> +        %td
> +          %input{:name =>  "deployables_selected[]", :type =>  "checkbox", 
> :value =>  deployable.id, :id =>  "deployable_checkbox_#{deployable.id}" }
> +        %td= link_to deployable.name, 
> image_factory_deployable_path(deployable)
> +
> +:javascript
> +  $(document).ready(function () {
> +    $('#delete_button').click(function(e) {
> +      if ($("#deployables_table inp...@type=radio]:checked").length == 0) {
> +        alert('Please select any deployable to be deleted before clicking 
> Delete button.');
> +        e.preventDefault();
> +      } else {
> +        if (!confirm("Are you sure you want to delete this deployable?")) {
> +          e.preventDefault();
> +        }
> +      }
> +    });
> +  });
> diff --git a/src/app/views/image_factory/deployables/_properties.haml 
> b/src/app/views/image_factory/deployables/_properties.haml
> new file mode 100644
> index 0000000..e8b513c
> --- /dev/null
> +++ b/src/app/views/image_factory/deployables/_properties.haml
> @@ -0,0 +1,4 @@
> +.grid_13
> +  %h2 #[email protected]}
> +
> +  = link_to 'Edit', edit_image_factory_deployable_path(@deployable), :class 
> =>  'button'
> diff --git a/src/app/views/image_factory/deployables/edit.haml 
> b/src/app/views/image_factory/deployables/edit.haml
> new file mode 100644
> index 0000000..fc47660
> --- /dev/null
> +++ b/src/app/views/image_factory/deployables/edit.haml
> @@ -0,0 +1,4 @@
> +%h2 Editing Deployable: #[email protected]}
> +
> +- form_for @deployable, :url =>  image_factory_deployable_path(@deployable), 
> :html =>  { :method =>  :put } do |f|
> +  = render :partial =>  "form", :locals =>  { :form =>  f }
> diff --git a/src/app/views/image_factory/deployables/index.haml 
> b/src/app/views/image_factory/deployables/index.haml
> index edd58fc..62ccbc6 100644
> --- a/src/app/views/image_factory/deployables/index.haml
> +++ b/src/app/views/image_factory/deployables/index.haml
> @@ -1 +1,2 @@
> -image_factory/deployables/index.haml
> +- content_for :list do
> +  = render :partial =>  'list'
> diff --git a/src/app/views/image_factory/deployables/new.haml 
> b/src/app/views/image_factory/deployables/new.haml
> new file mode 100644
> index 0000000..cc582a3
> --- /dev/null
> +++ b/src/app/views/image_factory/deployables/new.haml
> @@ -0,0 +1,3 @@
> +%h2 New Deployable
> +- form_for @deployable, :url =>  image_factory_deployables_path do |f|
> +  = render :partial =>  "form", :locals =>  { :form =>  f }
> diff --git a/src/app/views/image_factory/deployables/show.haml 
> b/src/app/views/image_factory/deployables/show.haml
> new file mode 100644
> index 0000000..05eeedd
> --- /dev/null
> +++ b/src/app/views/image_factory/deployables/show.haml
> @@ -0,0 +1,5 @@
> +- content_for :list do
> +  = render :partial =>  'list'
> +
> +- content_for :details do
> +  = render :partial =>  'layouts/details_pane'
> diff --git a/src/config/routes.rb b/src/config/routes.rb
> index 6d9b5cf..816a13a 100644
> --- a/src/config/routes.rb
> +++ b/src/config/routes.rb
> @@ -39,7 +39,8 @@ ActionController::Routing::Routes.draw do |map|
>     end
>
>     map.namespace 'image_factory' do |r|
> -    r.resources :assemblies, :deployables
> +    r.resources :assemblies
> +    r.resources :deployables, :collection =>  { :multi_destroy =>  :delete }
>       r.resources :templates, :collection =>  {:collections =>  :get, 
> :add_selected =>  :get, :metagroup_packages =>  :get, :remove_package =>  
> :get, :multi_destroy =>  :delete}
>       r.resources :builds
>     end


Please remove this file. It probably got included by accindent:


> diff --git a/src/db/development_structure.sql 
> b/src/db/development_structure.sql
> new file mode 100644
> index 0000000..e362260
> --- /dev/null
> +++ b/src/db/development_structure.sql
> @@ -0,0 +1,83 @@
> +CREATE TABLE "base_permission_objects" ("id" INTEGER PRIMARY KEY 
> AUTOINCREMENT NOT NULL, "name" varchar(255) NOT NULL, "created_at" datetime, 
> "updated_at" datetime);
> +CREATE TABLE "cloud_accounts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT 
> NULL, "label" varchar(255) NOT NULL, "username" varchar(255) NOT NULL, 
> "password" varchar(255) NOT NULL, "provider_id" integer NOT NULL, "quota_id" 
> integer, "lock_version" integer DEFAULT 0, "account_number" varchar(255) NOT 
> NULL, "x509_cert_priv" text NOT NULL, "x509_cert_pub" text NOT NULL, 
> "created_at" datetime, "updated_at" datetime);
> +CREATE TABLE "cloud_accounts_pool_families" ("cloud_account_id" integer NOT 
> NULL, "pool_family_id" integer NOT NULL);
> +CREATE TABLE "deployables" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 
> "name" varchar(255), "created_at" datetime, "updated_at" datetime);
> +CREATE TABLE "hardware_profile_map" ("aggregator_hardware_profile_id" 
> integer, "provider_hardware_profile_id" integer);
> +CREATE TABLE "hardware_profile_properties" ("id" INTEGER PRIMARY KEY 
> AUTOINCREMENT NOT NULL, "name" varchar(255) NOT NULL, "kind" varchar(255) NOT 
> NULL, "unit" varchar(255) NOT NULL, "value" varchar(255) NOT NULL, 
> "range_first" varchar(255), "range_last" varchar(255), "lock_version" integer 
> DEFAULT 0, "created_at" datetime, "updated_at" datetime);
> +CREATE TABLE "hardware_profiles" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT 
> NULL, "external_key" varchar(255) NOT NULL, "name" varchar(1024) NOT NULL, 
> "memory_id" integer, "storage_id" integer, "cpu_id" integer, 
> "architecture_id" integer, "provider_id" integer, "lock_version" integer 
> DEFAULT 0, "created_at" datetime, "updated_at" datetime);
> +CREATE TABLE "images" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 
> "uuid" varchar(255), "name" varchar(255) NOT NULL, "build_id" varchar(255), 
> "uri" varchar(255), "status" varchar(255), "target" varchar(255), 
> "template_id" integer, "created_at" datetime, "updated_at" datetime);
> +CREATE TABLE "instance_events" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT 
> NULL, "instance_id" integer NOT NULL, "event_type" varchar(255) NOT NULL, 
> "event_time" datetime, "status" varchar(255), "message" varchar(255), 
> "created_at" datetime, "updated_at" datetime);
> +CREATE TABLE "instance_hwps" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT 
> NULL, "memory" varchar(255), "cpu" varchar(255), "architecture" varchar(255), 
> "storage" varchar(255), "lock_version" integer DEFAULT 0);
> +CREATE TABLE "instance_keys" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT 
> NULL, "cloud_account_id" integer NOT NULL, "name" varchar(255) NOT NULL, 
> "pem" text, "created_at" datetime, "updated_at" datetime);
> +CREATE TABLE "instances" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 
> "external_key" varchar(255), "name" varchar(1024) NOT NULL, 
> "hardware_profile_id" integer NOT NULL, "template_id" integer NOT NULL, 
> "realm_id" integer, "owner_id" integer, "pool_id" integer NOT NULL, 
> "cloud_account_id" integer, "instance_hwp_id" integer, "public_addresses" 
> varchar(255), "private_addresses" varchar(255), "state" varchar(255), 
> "condor_job_id" varchar(255), "last_error" text(255), "instance_key_id" 
> integer, "lock_version" integer DEFAULT 0, "acc_pending_time" integer DEFAULT 
> 0, "acc_running_time" integer DEFAULT 0, "acc_shutting_down_time" integer 
> DEFAULT 0, "acc_stopped_time" integer DEFAULT 0, "time_last_pending" 
> datetime, "time_last_running" datetime, "time_last_shutting_down" datetime, 
> "time_last_stopped" datetime, "created_at" datetime, "updated_at" datetime);
> +CREATE TABLE "metadata_objects" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT 
> NULL, "key" varchar(255) NOT NULL, "value" varchar(255) NOT NULL, 
> "object_type" varchar(255), "lock_version" integer DEFAULT 0, "created_at" 
> datetime, "updated_at" datetime);
> +CREATE TABLE "permissions" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 
> "role_id" integer NOT NULL, "user_id" integer NOT NULL, 
> "permission_object_id" integer, "permission_object_type" varchar(255), 
> "lock_version" integer DEFAULT 0, "created_at" datetime, "updated_at" 
> datetime);
> +CREATE TABLE "pool_families" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT 
> NULL, "name" varchar(255) NOT NULL, "description" varchar(255), 
> "lock_version" integer DEFAULT 0, "created_at" datetime, "updated_at" 
> datetime);
> +CREATE TABLE "pools" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 
> "name" varchar(255) NOT NULL, "exported_as" varchar(255), "quota_id" integer, 
> "pool_family_id" integer NOT NULL, "lock_version" integer DEFAULT 0, 
> "created_at" datetime, "updated_at" datetime);
> +CREATE TABLE "privileges" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 
> "name" varchar(255) NOT NULL, "lock_version" integer DEFAULT 0, "created_at" 
> datetime, "updated_at" datetime);
> +CREATE TABLE "privileges_roles" ("privilege_id" integer NOT NULL, "role_id" 
> integer NOT NULL);
> +CREATE TABLE "property_enum_entries" ("id" INTEGER PRIMARY KEY AUTOINCREMENT 
> NOT NULL, "hardware_profile_property_id" integer NOT NULL, "value" 
> varchar(255) NOT NULL, "lock_version" integer DEFAULT 0, "created_at" 
> datetime, "updated_at" datetime);
> +CREATE TABLE "providers" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 
> "name" varchar(255) NOT NULL, "cloud_type" varchar(255) NOT NULL, "url" 
> varchar(255) NOT NULL, "lock_version" integer DEFAULT 0, "created_at" 
> datetime, "updated_at" datetime);
> +CREATE TABLE "quotas" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 
> "running_instances" integer DEFAULT 0, "total_instances" integer DEFAULT 0, 
> "maximum_running_instances" integer, "maximum_total_instances" integer, 
> "lock_version" integer DEFAULT 0, "created_at" datetime, "updated_at" 
> datetime);
> +CREATE TABLE "realm_map" ("frontend_realm_id" integer, "backend_realm_id" 
> integer);
> +CREATE TABLE "realms" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 
> "external_key" varchar(255) NOT NULL, "name" varchar(1024) NOT NULL, 
> "provider_id" integer, "lock_version" integer DEFAULT 0, "created_at" 
> datetime, "updated_at" datetime);
> +CREATE TABLE "replicated_images" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT 
> NULL, "image_id" integer NOT NULL, "provider_id" integer NOT NULL, 
> "provider_image_key" varchar(255), "uploaded" boolean DEFAULT 'f', 
> "registered" boolean DEFAULT 'f');
> +CREATE TABLE "roles" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 
> "name" varchar(255) NOT NULL, "scope" varchar(255) NOT NULL, "lock_version" 
> integer DEFAULT 0, "created_at" datetime, "updated_at" datetime);
> +CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL);
> +CREATE TABLE "sessions" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 
> "session_id" varchar(255) NOT NULL, "data" text, "created_at" datetime, 
> "updated_at" datetime);
> +CREATE TABLE "tasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 
> "user" varchar(255), "type" varchar(255), "action" varchar(255), "state" 
> varchar(255), "task_target_id" integer, "task_target_type" varchar(255), 
> "args" varchar(255), "created_at" datetime, "time_submitted" datetime, 
> "time_started" datetime, "time_ended" datetime, "message" text, 
> "failure_code" varchar(255), "lock_version" integer DEFAULT 0);
> +CREATE TABLE "templates" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 
> "uuid" varchar(255) NOT NULL, "xml" blob NOT NULL, "uri" varchar(255), "name" 
> varchar(255), "platform" varchar(255), "platform_version" varchar(255), 
> "architecture" varchar(255), "summary" text, "complete" boolean DEFAULT 'f', 
> "uploaded" boolean DEFAULT 'f', "imported" boolean DEFAULT 'f', 
> "images_count" integer, "created_at" datetime, "updated_at" datetime);
> +CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 
> "login" varchar(255) NOT NULL, "email" varchar(255) NOT NULL, 
> "crypted_password" varchar(255) NOT NULL, "password_salt" varchar(255) NOT 
> NULL, "persistence_token" varchar(255) NOT NULL, "single_access_token" 
> varchar(255) NOT NULL, "perishable_token" varchar(255) NOT NULL, "first_name" 
> varchar(255), "last_name" varchar(255), "quota_id" integer, "login_count" 
> integer DEFAULT 0 NOT NULL, "failed_login_count" integer DEFAULT 0 NOT NULL, 
> "last_request_at" datetime, "current_login_at" datetime, "last_login_at" 
> datetime, "current_login_ip" varchar(255), "last_login_ip" varchar(255), 
> "created_at" datetime, "updated_at" datetime);
> +CREATE INDEX "index_sessions_on_session_id" ON "sessions" ("session_id");
> +CREATE INDEX "index_sessions_on_updated_at" ON "sessions" ("updated_at");
> +CREATE INDEX "index_users_on_last_request_at" ON "users" ("last_request_at");
> +CREATE INDEX "index_users_on_login" ON "users" ("login");
> +CREATE INDEX "index_users_on_persistence_token" ON "users" 
> ("persistence_token");
> +CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" 
> ("version");
> +INSERT INTO schema_migrations (version) VALUES ('200909011700');
> +
> +INSERT INTO schema_migrations (version) VALUES ('20090731200741');
> +
> +INSERT INTO schema_migrations (version) VALUES ('20090801045212');
> +
> +INSERT INTO schema_migrations (version) VALUES ('20090802000000');
> +
> +INSERT INTO schema_migrations (version) VALUES ('20090803000000');
> +
> +INSERT INTO schema_migrations (version) VALUES ('20090803141507');
> +
> +INSERT INTO schema_migrations (version) VALUES ('20090804135630');
> +
> +INSERT INTO schema_migrations (version) VALUES ('20090804140143');
> +
> +INSERT INTO schema_migrations (version) VALUES ('20090804141600');
> +
> +INSERT INTO schema_migrations (version) VALUES ('20090804142049');
> +
> +INSERT INTO schema_migrations (version) VALUES ('20090831140000');
> +
> +INSERT INTO schema_migrations (version) VALUES ('20090917192602');
> +
> +INSERT INTO schema_migrations (version) VALUES ('20091008153046');
> +
> +INSERT INTO schema_migrations (version) VALUES ('20091008153058');
> +
> +INSERT INTO schema_migrations (version) VALUES ('20091008153106');
> +
> +INSERT INTO schema_migrations (version) VALUES ('20091019215838');
> +
> +INSERT INTO schema_migrations (version) VALUES ('20100707000000');
> +
> +INSERT INTO schema_migrations (version) VALUES ('20100810221250');
> +
> +INSERT INTO schema_migrations (version) VALUES ('20100830150014');
> +
> +INSERT INTO schema_migrations (version) VALUES ('20100902081651');
> +
> +INSERT INTO schema_migrations (version) VALUES ('20101018174458');
> +
> +INSERT INTO schema_migrations (version) VALUES ('20101021172441');
> +
> +INSERT INTO schema_migrations (version) VALUES ('20110103160939');
> +
> +INSERT INTO schema_migrations (version) VALUES ('20110112094108');
> \ No newline at end of file

^^^


> diff --git a/src/db/migrate/20110112094108_create_deployables.rb 
> b/src/db/migrate/20110112094108_create_deployables.rb
> new file mode 100644
> index 0000000..5ec0982
> --- /dev/null
> +++ b/src/db/migrate/20110112094108_create_deployables.rb
> @@ -0,0 +1,13 @@
> +class CreateDeployables<  ActiveRecord::Migration
> +  def self.up
> +    create_table :deployables do |t|
> +      t.string :name
> +
> +      t.timestamps
> +    end
> +  end
> +
> +  def self.down
> +    drop_table :deployables
> +  end
> +end
> diff --git a/src/features/deployable.feature b/src/features/deployable.feature
> new file mode 100644
> index 0000000..17c5764
> --- /dev/null
> +++ b/src/features/deployable.feature
> @@ -0,0 +1,50 @@
> +Feature: Manage Deployables
> +  In order to manage my cloud infrastructure
> +  As a user
> +  I want to manage deployables
> +
> +  Background:
> +    Given I am an authorised user
> +    And I am logged in
> +    And I am using new UI
> +
> +  Scenario: List deployables
> +    Given I am on the homepage
> +    And there is a deployable named "MySQL cluster"
> +    When I go to the image factory deployables page
> +    Then I should see "MySQL cluster"
> +
> +  Scenario: Create a new Deployable
> +    Given there is a deployable named "MySQL cluster"
> +    And I am on the image factory deployables page
> +    When I follow "Create"
> +    Then I should be on the new image factory deployable page
> +    And I should see "New Deployable"
> +    When I fill in "deployable[name]" with "App"
> +    And I press "Save"
> +    Then I should be on App's image factory deployable page
> +    And I should see "Deployable added"
> +    And I should have a deployable named "App"
> +    And I should see "App"
> +
> +  Scenario: Edit a deployable
> +    Given there is a deployable named "MySQL cluster"
> +    And I am on the image factory deployables page
> +    When I follow "MySQL cluster"
> +    And I follow "Edit"
> +    Then I should be on the edit image factory deployable page
> +    And I should see "Editing Deployable"
> +    When I fill in "deployable[name]" with "AppModified"
> +    And I press "Save"
> +    Then I should be on AppModified's image factory deployable page
> +    And I should see "Deployable updated"
> +    And I should have a deployable named "AppModified"
> +    And I should see "AppModified"
> +
> +  Scenario: Delete a deployable
> +    Given there is a deployable named "App"
> +    And I am on the image factory deployables page
> +    When I check the "App" deployable
> +    And I press "Delete"
> +    Then I should be on the image factory deployables page
> +    And there should be no deployables
> diff --git a/src/features/step_definitions/deployable_steps.rb 
> b/src/features/step_definitions/deployable_steps.rb
> new file mode 100644
> index 0000000..d4b6af6
> --- /dev/null
> +++ b/src/features/step_definitions/deployable_steps.rb
> @@ -0,0 +1,20 @@
> +Then /^there should be no deployables$/ do
> +  Deployable.count.should == 0
> +end
> +
> +Given /^there are no deployables$/ do
> +  Deployable.count.should == 0
> +end
> +
> +Then /^I should have a deployable named "([^"]*)"$/ do |name|
> +  Deployable.find_by_name(name).should_not be_nil
> +end
> +
> +Given /^there is a deployable named "([^"]*)"$/ do |name|
> +  Deployable.create!(:name =>  name)
> +end
> +
> +When /^I check the "([^"]*)" deployable$/ do |name|
> +  deployable = Deployable.find_by_name(name)
> +  check("deployable_checkbox_#{deployable.id}")
> +end
> diff --git a/src/features/support/paths.rb b/src/features/support/paths.rb
> index 66de0d2..c0c77dc 100644
> --- a/src/features/support/paths.rb
> +++ b/src/features/support/paths.rb
> @@ -101,6 +101,9 @@ module NavigationHelpers
>       when /^(.*)'s provider account page$/
>         admin_provider_account_path(CloudAccount.find_by_label($1))
>
> +    when /^(.*)'s image factory deployable page$/
> +      image_factory_deployable_path(Deployable.find_by_name($1))
> +
>       # Add more mappings here.
>       # Here is an example that pulls values out of the Regexp:
>       #

_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel

Reply via email to