Permalink
Browse files

cleanup

  • Loading branch information...
theganyo committed Oct 11, 2012
1 parent 04fecc0 commit de33aa303163a5ff7250611c775924eb87e02bac
Showing with 9 additions and 17 deletions.
  1. +8 −17 spec/spec_helper.rb
  2. +1 −0 spec/usergrid/core/resource_spec.rb
View
@@ -17,9 +17,14 @@
SPEC_SETTINGS = YAML::load_file(File.join File.dirname(__FILE__), 'spec_settings.yaml')
def login_management
management = Usergrid::Resource.new(SPEC_SETTINGS[:api_url]).management
management.login SPEC_SETTINGS[:organization][:username], SPEC_SETTINGS[:organization][:password]
management
end
# ensure we are correctly setup (management login & organization)
management = Usergrid::Resource.new(SPEC_SETTINGS[:api_url]).management
management.login SPEC_SETTINGS[:management][:username], SPEC_SETTINGS[:management][:password]
management = login_management
begin
management.create_organization(SPEC_SETTINGS[:organization][:name],
@@ -36,14 +41,6 @@
end
end
def app_endpoint
"#{SPEC_SETTINGS[:organization][:name]}/#{SPEC_SETTINGS[:application][:name]}"
end
def org_endpoint
"#{SPEC_SETTINGS[:organization][:name]}"
end
def create_random_application
management = login_management
organization = management.organization SPEC_SETTINGS[:organization][:name]
@@ -56,7 +53,7 @@ def create_random_application
def delete_application(application)
management = login_management
application.auth_token = management.auth_token
application.delete
application.delete rescue nil # not implemented on server yet
end
def create_random_user(application, login=false)
@@ -69,9 +66,3 @@ def create_random_user(application, login=false)
application.login user_hash[:username], user_hash[:password] if login
entity
end
def login_management
management = Usergrid::Resource.new(SPEC_SETTINGS[:api_url]).management
management.login SPEC_SETTINGS[:organization][:username], SPEC_SETTINGS[:organization][:password]
management
end
@@ -18,6 +18,7 @@
end
it "should fail with a 401 when lacking auth" do
app_endpoint = "#{SPEC_SETTINGS[:organization][:name]}/#{SPEC_SETTINGS[:application][:name]}"
expect { @resource[app_endpoint].get }.to raise_error(RestClient::Unauthorized) { |exception|
exception.response.code.should eq 401
}

0 comments on commit de33aa3

Please sign in to comment.