From 556e0980228ac33831cb736ba6d80d314aa4dcaf Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Fri, 31 Aug 2018 20:34:58 -0500 Subject: [PATCH] fix feature tests --- app/models/concerns/has_attributes.rb | 8 ++++---- features/step_definitions/steps.rb | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/models/concerns/has_attributes.rb b/app/models/concerns/has_attributes.rb index 6ea8a526..4910e184 100644 --- a/app/models/concerns/has_attributes.rb +++ b/app/models/concerns/has_attributes.rb @@ -69,13 +69,13 @@ module HasAttributes def name_field category_ids = AttributeCategory.where( - user_id: user.id, + user_id: user_id, entity_type: self.class.name.downcase ).pluck(:id) # Todo these two queries should be able to be joined into one name_field = AttributeField.find_by( - user_id: user.id, + user_id: user_id, attribute_category_id: category_ids, field_type: 'name' ) @@ -119,13 +119,13 @@ module HasAttributes def overview_field(label) category_ids = AttributeCategory.where( - user_id: user.id, + user_id: user_id, entity_type: self.class.name.downcase ).pluck(:id) # Todo these two queries should be able to be joined into one field = AttributeField.find_by( - user_id: user.id, + user_id: user_id, attribute_category_id: category_ids, label: label ) diff --git a/features/step_definitions/steps.rb b/features/step_definitions/steps.rb index c5691ad9..dca8c0e4 100644 --- a/features/step_definitions/steps.rb +++ b/features/step_definitions/steps.rb @@ -41,7 +41,7 @@ end When(/^I create a (character|location|item|universe)$/) do |model| visit new_polymorphic_path(model) - fill_in "#{model}_name", with: 'My new content' + fill_in("#{model}_custom_attribute_values__value", with: 'My new content', match: :first) click_on "Create" @model = model.classify.constantize.where(name: 'My new content', user: @user).first end @@ -57,7 +57,7 @@ end When(/^I change my (character|location|item|universe)\'s name$/) do |model| visit polymorphic_path(@model) click_on 'edit' - fill_in "#{model}_name", with: 'My changed name' + fill_in("#{model}_custom_attribute_values__value", with: "My changed name", match: :first) click_on 'save' @model.reload end @@ -67,7 +67,7 @@ When(/^I view that (character|location|item|universe)$/) do |_model| end Then(/^that new name should be saved$/) do - expect(@model.name).to eq('My changed name') + expect(@model.name_field_value).to eq('My changed name') end When 'I answer the Serendipitous question' do