Skip to content

Instantly share code, notes, and snippets.

@elrayle
Created September 12, 2014 19:07
Show Gist options
  • Save elrayle/50d14ba381553107e618 to your computer and use it in GitHub Desktop.
Save elrayle/50d14ba381553107e618 to your computer and use it in GitHub Desktop.
ActiveTriples: Test for set_value deletes all values
describe "set_value" do
it "should add a single value when none exist a priori" do
vals = subject.get_values('aggregates')
vals << "foo"
subject.set_value('aggregates',vals)
expect(subject.get_values('aggregates')).to eq ["foo"]
end
it "should add a single value when one value exists a priority" do
subject.aggregates = "foo"
vals = subject.get_values('aggregates')
vals << "bar"
subject.set_value('aggregates',vals)
expect(subject.get_values('aggregates')).to eq ["foo","bar"]
end
it "should not change the value before calling set value" do
subject.aggregates = "foo"
vals = subject.get_values('aggregates')
vals << "bar"
expect(subject.get_values('aggregates')).to eq ["foo"]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment