Skip to content
Snippets Groups Projects
Commit aaded917 authored by Mauricio Giacomini Girardello's avatar Mauricio Giacomini Girardello
Browse files

adding unit tests for repository classes

parent d7961285
No related branches found
No related tags found
No related merge requests found
require 'test_helper'
require 'test_model_repository'
class RepositoryEnvironmentsTest < ActiveSupport::TestCase
def setup
RepositoryEnvironments.create :test_env do |repository|
repository.register :test_model, TestModelRepository.new
end
end
test 'can create a repositories inside env' do
RepositoryEnvironments.create :test_specific_env do |repository|
repository.register :test_model, TestModelRepository.new
end
assert_count 1, RepositoryEnvironments.fetch(:test_specific_env).repositories
end
test 'select a repository by environment' do
assert RepositoryEnvironments.fetch(:test_env).for(:test_model).working?
end
end
\ No newline at end of file
require 'test_helper'
require 'test_model_repository'
class RepositoryTest < ActiveSupport::TestCase
def setup
@repository = Repository.new
@repository.register :test_model, TestModelRepository.new
end
test 'can register a repository' do
assert_count 1, @repository.repositories
end
test 'can unregister a repository' do
@repository.unregister :test_model
assert_count 0, @repository.repositories
end
test 'select a repository by type' do
assert @repository.for(:test_model).working?
end
end
\ No newline at end of file
class TestModelRepository
def working?
true
end
end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment