test/test_features.rb in heroku-api-0.3.20 vs test/test_features.rb in heroku-api-0.3.21
- old
+ new
@@ -3,28 +3,27 @@
class TestFeatures < Minitest::Test
def setup
@feature_data ||= begin
data = File.read("#{File.dirname(__FILE__)}/../lib/heroku/api/mock/cache/get_features.json")
- features_data = MultiJson.load(data)
- features_data.detect {|feature| feature['name'] == 'user_env_compile'}
+ MultiJson.load(data).first
end
end
def test_delete_feature
with_app do |app_data|
- heroku.post_feature('user_env_compile', app_data['name'])
- response = heroku.delete_feature('user_env_compile', app_data['name'])
+ heroku.post_feature(@feature_data['name'], app_data['name'])
+ response = heroku.delete_feature(@feature_data['name'], app_data['name'])
assert_equal(200, response.status)
assert_equal(@feature_data, response.body)
end
end
def test_delete_feature_app_not_found
assert_raises(Heroku::API::Errors::RequestFailed) do
- heroku.delete_feature('user_env_compile', random_name)
+ heroku.delete_feature(@feature_data['name'], random_name)
end
end
def test_delete_feature_feature_not_found
with_app do |app_data|
@@ -44,11 +43,11 @@
end
end
def test_get_feature
with_app do |app_data|
- response = heroku.get_feature('user_env_compile', app_data['name'])
+ response = heroku.get_feature(@feature_data['name'], app_data['name'])
assert_equal(200, response.status)
assert_equal(@feature_data, response.body)
end
end
@@ -61,19 +60,19 @@
end
end
def test_post_feature
with_app do |app_data|
- response = heroku.post_feature('user_env_compile', app_data['name'])
+ response = heroku.post_feature(@feature_data['name'], app_data['name'])
assert_equal(201, response.status)
assert_equal(@feature_data.merge('enabled' => true), response.body)
end
end
def test_post_feature_app_not_found
assert_raises(Heroku::API::Errors::NotFound) do
- heroku.post_feature('user_env_compile', random_name)
+ heroku.post_feature(@feature_data['name'], random_name)
end
end
def test_post_feature_feature_not_found
with_app do |app_data|