Skip to content

Commit

Permalink
Merge pull request #36 from dasch/dasch/last-updated-at
Browse files Browse the repository at this point in the history
Add Arturo::Feature.last_updated_at
  • Loading branch information
jamesarosen committed Mar 7, 2013
2 parents f3d2fa4 + 7b0b800 commit e9ff0fe
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/models/arturo/feature.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ def inspect
"<Arturo::Feature #{name}, deployed to #{deployment_percentage}%>"
end

def self.last_updated_at
maximum(:updated_at)
end

protected

def passes_threshold?(feature_recipient)
Expand Down
17 changes: 17 additions & 0 deletions test/dummy_app/test/unit/feature_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,23 @@ def test_requires_a_symbol
assert feature.errors[:symbol].present?
end

def test_last_updated_at
Timecop.travel(Time.local(2008, 9, 1, 12, 0, 0))
feature1 = create(:feature)

updated_at = Time.local(2011, 9, 1, 12, 0, 0)

Timecop.freeze(updated_at) do
feature2 = create(:feature)
end

assert_equal updated_at, Arturo::Feature.last_updated_at
end

def test_last_updated_at_with_no_features
assert_nil Arturo::Feature.last_updated_at
end

# regression
# @see https://github.com/jamesarosen/arturo/issues/7
def test_deployment_percentage_is_not_overwritten_on_create
Expand Down

0 comments on commit e9ff0fe

Please sign in to comment.