Sha256: ae19fd247dbfa407d4136574c9593b382e247f42be4eb5a4a9488e0ad1ea2836

Contents?: true

Size: 735 Bytes

Versions: 37

Compression:

Stored size: 735 Bytes

Contents

class ResourceTestCase < Test::Unit::TestCase

  include Rack::Test::Methods
  include RequestHelpers
  include ModelFactories

  before :all do
    @users_by_role = {}
    %w(basic curator admin).map do |role|
      @users_by_role[role] = create_user(
        :name  => "#{role} User",
        :email => "#{role}-user@inter.net",
        :role  => role
      )
    end
  end
  
  after :all do
    @users_by_role.each_pair { |role, user| user.destroy }
  end
  
  def user_for(role)
    @users_by_role[role]
  end
  
  def api_key_for(role)
    key = @users_by_role[role]._api_key
    raise "API key not found" unless key
    key
  end

  def valid_params_for(role)
    @valid_params.merge(:api_key => api_key_for(role))
  end
  
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
sinatra_resource-0.4.21 examples/datacatalog/test/helpers/test_cases/resource_test_case.rb
sinatra_resource-0.4.20 examples/datacatalog/test/helpers/test_cases/resource_test_case.rb
sinatra_resource-0.4.19 examples/datacatalog/test/helpers/test_cases/resource_test_case.rb
sinatra_resource-0.4.18 examples/datacatalog/test/helpers/test_cases/resource_test_case.rb
sinatra_resource-0.4.17 examples/datacatalog/test/helpers/test_cases/resource_test_case.rb
sinatra_resource-0.4.16 examples/datacatalog/test/helpers/test_cases/resource_test_case.rb
sinatra_resource-0.4.15 examples/datacatalog/test/helpers/test_cases/resource_test_case.rb
sinatra_resource-0.4.14 examples/datacatalog/test/helpers/test_cases/resource_test_case.rb
sinatra_resource-0.4.13 examples/datacatalog/test/helpers/test_cases/resource_test_case.rb
sinatra_resource-0.4.12 examples/datacatalog/test/helpers/test_cases/resource_test_case.rb
sinatra_resource-0.4.11 examples/datacatalog/test/helpers/test_cases/resource_test_case.rb
sinatra_resource-0.4.10 examples/datacatalog/test/helpers/test_cases/resource_test_case.rb
sinatra_resource-0.4.9 examples/datacatalog/test/helpers/test_cases/resource_test_case.rb
sinatra_resource-0.4.8 examples/datacatalog/test/helpers/test_cases/resource_test_case.rb
sinatra_resource-0.4.7 examples/datacatalog/test/helpers/test_cases/resource_test_case.rb
sinatra_resource-0.4.6 examples/datacatalog/test/helpers/test_cases/resource_test_case.rb
sinatra_resource-0.4.5 examples/datacatalog/test/helpers/test_cases/resource_test_case.rb
sinatra_resource-0.4.4 examples/datacatalog/test/helpers/test_cases/resource_test_case.rb
sinatra_resource-0.4.3 examples/datacatalog/test/helpers/test_cases/resource_test_case.rb
sinatra_resource-0.4.2 examples/datacatalog/test/helpers/test_cases/resource_test_case.rb