This slipped through the cracks on a previous ACK from yours truly. --- src/app/models/instance.rb | 3 +++ src/features/instance.feature | 20 +++++++++++++++++--- src/features/step_definitions/instance_steps.rb | 10 ++++++++++ src/spec/factories/instance.rb | 5 +++++ src/spec/factories/user.rb | 5 +++++ 5 files changed, 40 insertions(+), 3 deletions(-)
diff --git a/src/app/models/instance.rb b/src/app/models/instance.rb index b84a596..b6af901 100644 --- a/src/app/models/instance.rb +++ b/src/app/models/instance.rb @@ -30,6 +30,9 @@ class Instance < ActiveRecord::Base text :public_addresses, :as => :code_substring text :private_addresses, :as => :code_substring text :state, :as => :code_substring + text :owner do + owner.last_name + " " + owner.first_name + end end
cattr_reader :per_page diff --git a/src/features/instance.feature b/src/features/instance.feature index ad22025..5794333 100644 --- a/src/features/instance.feature +++ b/src/features/instance.feature @@ -81,32 +81,46 @@ Feature: Mange Instances Scenario: Search for instances Given there are the following instances: | name | external_key | state | public_addresses | private_addresses | - | mock | ext_mock | running | mock.public.address | mock.private.address | + | mockname | ext_mock | running | mock.public.address | mock.private.address | | test | ext_test | pending | test.public.address | test.private.address | | other | ext_other | stopped | other.public.address | other.private.address | + And there is the following instance with a differently-named owning user: + | name | external_key | state | public_addresses | private_addresses | + | foo | ext_foo | stopped | foo.public.address | foo.private.address | And I am on the the instances page - When I fill in "q" with "mock" + When I fill in "q" with "mockname" And I press "Search" Then I should see "mock" And I should not see "test" And I should not see "other" + And I should not see "foo" When I fill in "q" with "ext_other" And I press "Search" Then I should not see "mock" And I should not see "test" And I should see "other" + And I should not see "foo" When I fill in "q" with "pending" And I press "Search" Then I should not see "mock" And I should see "test" And I should not see "other" + And I should not see "foo" When I fill in "q" with "mock.public.address" And I press "Search" Then I should see "mock" And I should not see "test" And I should not see "other" + And I should not see "foo" When I fill in "q" with "test.private.address" And I press "Search" Then I should not see "mock" And I should see "test" - And I should not see "other" \ No newline at end of file + And I should not see "other" + And I should not see "foo" + When I fill in "q" with "Doe" + And I press "Search" + Then I should not see "mock" + And I should not see "test" + And I should not see "other" + And I should see "foo" diff --git a/src/features/step_definitions/instance_steps.rb b/src/features/step_definitions/instance_steps.rb index 4324891..4cca209 100644 --- a/src/features/step_definitions/instance_steps.rb +++ b/src/features/step_definitions/instance_steps.rb @@ -78,3 +78,13 @@ Given /^there are the following instances:$/ do |table| :private_addresses => hash['private_addresses']) end end + +Given /^there is the following instance with a differently-named owning user:$/ do |table| + table.hashes.each do |hash| + Factory(:other_owner_instance, :name => hash['name'], + :external_key => hash['external_key'], + :state => hash['state'], + :public_addresses => hash['public_addresses'], + :private_addresses => hash['private_addresses']) + end +end diff --git a/src/spec/factories/instance.rb b/src/spec/factories/instance.rb index 7533ba9..dd49f9f 100644 --- a/src/spec/factories/instance.rb +++ b/src/spec/factories/instance.rb @@ -9,6 +9,11 @@ Factory.define :instance do |i| i.state "running" end
+Factory.define :other_owner_instance, :parent => :instance do |i| + i.association :owner, :factory => :other_named_user +end + + Factory.define :mock_running_instance, :parent => :instance do |i| i.instance_key { |k| k.association(:mock_instance_key)} end diff --git a/src/spec/factories/user.rb b/src/spec/factories/user.rb index a9dd23e..22abc5e 100644 --- a/src/spec/factories/user.rb +++ b/src/spec/factories/user.rb @@ -8,6 +8,11 @@ Factory.define :user do |u| u.association :quota end
+Factory.define :other_named_user, :parent => :user do |u| + u.first_name 'Jane' + u.last_name 'Doe' +end + Factory.define :tuser, :parent => :user do |u| end
ACK
On 01/28/2011 08:17 PM, Steve Linabery wrote:
This slipped through the cracks on a previous ACK from yours truly.
src/app/models/instance.rb | 3 +++ src/features/instance.feature | 20 +++++++++++++++++--- src/features/step_definitions/instance_steps.rb | 10 ++++++++++ src/spec/factories/instance.rb | 5 +++++ src/spec/factories/user.rb | 5 +++++ 5 files changed, 40 insertions(+), 3 deletions(-)
diff --git a/src/app/models/instance.rb b/src/app/models/instance.rb index b84a596..b6af901 100644 --- a/src/app/models/instance.rb +++ b/src/app/models/instance.rb @@ -30,6 +30,9 @@ class Instance< ActiveRecord::Base text :public_addresses, :as => :code_substring text :private_addresses, :as => :code_substring text :state, :as => :code_substring
text :owner do
owner.last_name + " " + owner.first_name
end end
cattr_reader :per_page
diff --git a/src/features/instance.feature b/src/features/instance.feature index ad22025..5794333 100644 --- a/src/features/instance.feature +++ b/src/features/instance.feature @@ -81,32 +81,46 @@ Feature: Mange Instances Scenario: Search for instances Given there are the following instances: | name | external_key | state | public_addresses | private_addresses |
- | mock | ext_mock | running | mock.public.address | mock.private.address |
- | mockname | ext_mock | running | mock.public.address | mock.private.address | | test | ext_test | pending | test.public.address | test.private.address | | other | ext_other | stopped | other.public.address | other.private.address |
- And there is the following instance with a differently-named owning user:
- | name | external_key | state | public_addresses | private_addresses |
- | foo | ext_foo | stopped | foo.public.address | foo.private.address | And I am on the the instances page
- When I fill in "q" with "mock"
- When I fill in "q" with "mockname" And I press "Search" Then I should see "mock" And I should not see "test" And I should not see "other"
- And I should not see "foo" When I fill in "q" with "ext_other" And I press "Search" Then I should not see "mock" And I should not see "test" And I should see "other"
- And I should not see "foo" When I fill in "q" with "pending" And I press "Search" Then I should not see "mock" And I should see "test" And I should not see "other"
- And I should not see "foo" When I fill in "q" with "mock.public.address" And I press "Search" Then I should see "mock" And I should not see "test" And I should not see "other"
- And I should not see "foo" When I fill in "q" with "test.private.address" And I press "Search" Then I should not see "mock" And I should see "test"
- And I should not see "other"
\ No newline at end of file
- And I should not see "other"
- And I should not see "foo"
- When I fill in "q" with "Doe"
- And I press "Search"
- Then I should not see "mock"
- And I should not see "test"
- And I should not see "other"
- And I should see "foo"
diff --git a/src/features/step_definitions/instance_steps.rb b/src/features/step_definitions/instance_steps.rb index 4324891..4cca209 100644 --- a/src/features/step_definitions/instance_steps.rb +++ b/src/features/step_definitions/instance_steps.rb @@ -78,3 +78,13 @@ Given /^there are the following instances:$/ do |table| :private_addresses => hash['private_addresses']) end end
+Given /^there is the following instance with a differently-named owning user:$/ do |table|
- table.hashes.each do |hash|
- Factory(:other_owner_instance, :name => hash['name'],
:external_key => hash['external_key'],
:state => hash['state'],
:public_addresses => hash['public_addresses'],
:private_addresses => hash['private_addresses'])
- end
+end diff --git a/src/spec/factories/instance.rb b/src/spec/factories/instance.rb index 7533ba9..dd49f9f 100644 --- a/src/spec/factories/instance.rb +++ b/src/spec/factories/instance.rb @@ -9,6 +9,11 @@ Factory.define :instance do |i| i.state "running" end
+Factory.define :other_owner_instance, :parent => :instance do |i|
- i.association :owner, :factory => :other_named_user
+end
- Factory.define :mock_running_instance, :parent => :instance do |i| i.instance_key { |k| k.association(:mock_instance_key)} end
diff --git a/src/spec/factories/user.rb b/src/spec/factories/user.rb index a9dd23e..22abc5e 100644 --- a/src/spec/factories/user.rb +++ b/src/spec/factories/user.rb @@ -8,6 +8,11 @@ Factory.define :user do |u| u.association :quota end
+Factory.define :other_named_user, :parent => :user do |u|
- u.first_name 'Jane'
- u.last_name 'Doe'
+end
- Factory.define :tuser, :parent => :user do |u| end
aeolus-devel@lists.fedorahosted.org