```ruby
Then(/^the data should be stored in the "(.*?)" metric$/) do |metric_name|
  @metric = Metric.where(name: metric_name).last
  @metric.name.should == metric_name
end

Then(/^the time of the stored metric should be "(.*?)"$/) do |time|
  @metric.time.should == DateTime.parse(time)
end

Then(/^the value of the metric should be:$/) do |string|
  @metric.value.to_json.should == string
end```

Fix steps to make sure we definitely get the last added metric
user
```ruby
Then(/^the data should be stored in the "(.*?)" metric$/) do |metric_name|
  @metric = Metric.where(name: metric_name).order_by(time: 'asc').last
  @metric.name.should == metric_name
end

Then(/^the time of the stored metric should be "(.*?)"$/) do |time|
  @metric.time.should == DateTime.parse(time)
end

Then(/^the value of the metric should be:$/) do |string|
  @metric.value.to_json.should == string
end
```
assistant