spec/statrapator/client/projects_spec.rb in statraptor-0.2.3 vs spec/statrapator/client/projects_spec.rb in statraptor-0.2.4
- old
+ new
@@ -36,7 +36,25 @@
it "raises an unauthorized exception if the user credentials are incorrect" do
lambda {
client.delete_project(:user_credentials => "abc123", :subdomain => "modern-marvels")
}.should raise_error(StatRaptor::Error::Unauthorized, "Invalid user API key specified")
end
+
+ it "allows re-creating a deleted project" do
+ # Set up a user and project
+ user = client.create_user(:email => random_email, :chargify_api_key => "ABC123")
+ project = client.create_project(:user_credentials => user["user_credentials"], :project => {
+ :name => "Modern Marvels", :subdomain => "modern-marvels", :component => "advanced"
+ })
+
+ # Delete the project
+ client.delete_project(:user_credentials => user["user_credentials"], :subdomain => "modern-marvels")
+
+ # Recreate the project
+ lambda {
+ project = client.create_project(:user_credentials => user["user_credentials"], :project => {
+ :name => "Modern Marvels", :subdomain => "modern-marvels", :component => "advanced"
+ })
+ }.should_not raise_error(StatRaptor::Error, "Subdomain has already been taken")
+ end
end
end