Sha256: 2f2deb20b517d579d31866f70959dda20265c01e59a8a253d8b125d70e5955b2

Contents?: true

Size: 727 Bytes

Versions: 3

Compression:

Stored size: 727 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

3 entries across 3 versions & 1 rubygems

Version Path
sinatra_resource-0.4.24 examples/datacatalog/test/helpers/test_cases/resource_test_case.rb
sinatra_resource-0.4.23 examples/datacatalog/test/helpers/test_cases/resource_test_case.rb
sinatra_resource-0.4.22 examples/datacatalog/test/helpers/test_cases/resource_test_case.rb