Simplify test data: fruit names

It's not clear to me that random test data makes this particular
test better.
This commit is contained in:
Jared Beck 2015-12-19 21:16:25 -05:00
parent 811dc0ed47
commit f4cf6c16db
1 changed files with 6 additions and 9 deletions

View File

@ -52,21 +52,18 @@ if JsonVersion.table_exists?
end
context "valid arguments", :versioning => true do
let(:fruit_names) { %w(apple orange lemon banana lime strawberry blueberry) }
let(:tropical_fruit_names) { %w(coconut pineapple kiwi mango melon) }
let(:fruit) { Fruit.new }
let(:name) { 'pomegranate' }
let(:color) { %w[red green] }
let(:fruit) { Fruit.create!(name: name[0]) }
let(:name) { %w[banana kiwi mango] }
before do
fruit.update_attributes!(:name => name)
fruit.update_attributes!(:name => tropical_fruit_names.sample, :color => color[0])
fruit.update_attributes!(:name => fruit_names.sample, :color => color[1])
fruit.update_attributes!(name: name[1], color: color[0])
fruit.update_attributes!(name: name[2], color: color[1])
end
it "finds versions according to their `object_changes` contents" do
expect(
fruit.versions.where_object_changes(name: name)
fruit.versions.where_object_changes(name: name[0])
).to match_array(fruit.versions[0..1])
expect(
fruit.versions.where_object_changes(color: color[0])
@ -75,7 +72,7 @@ if JsonVersion.table_exists?
it "finds versions with multiple attributes changed" do
expect(
fruit.versions.where_object_changes(color: color[0], name: name)
fruit.versions.where_object_changes(color: color[0], name: name[0])
).to match_array([fruit.versions[1]])
end
end