fix feature tests

This commit is contained in:
Andrew Brown 2018-08-31 20:34:58 -05:00
parent 1a03148cfa
commit 556e098022
2 changed files with 7 additions and 7 deletions

View File

@ -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
)

View File

@ -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