Skip to content

Instantly share code, notes, and snippets.

@gogogarrett
Created December 17, 2014 05:35
Show Gist options
  • Save gogogarrett/d4a086a31c893103becf to your computer and use it in GitHub Desktop.
Save gogogarrett/d4a086a31c893103becf to your computer and use it in GitHub Desktop.
Lotus model - FileSystemAdapter - issue.
require 'test_helper'
describe Lotus::Model::Adapters::FileSystemAdapter do
before do
TestUser = Struct.new(:id, :name, :age) do
include Lotus::Entity
end
class TestUserRepository
include Lotus::Repository
end
TestDevice = Struct.new(:id) do
include Lotus::Entity
end
class TestDeviceRepository
include Lotus::Repository
end
@mapper = Lotus::Model::Mapper.new do
collection :users do
entity TestUser
attribute :id, Integer
attribute :name, String
attribute :age, Integer
end
collection :devices do
entity TestDevice
attribute :id, Integer
end
end.load!
@adapter = Lotus::Model::Adapters::FileSystemAdapter.new(@mapper, FILE_SYSTEM_CONNECTION_STRING)
# @adapter.clear(collection) <-- offending line (maybe this needs to be called in the config somewhere?
@verifier = Lotus::Model::Adapters::FileSystemAdapter.new(@mapper, FILE_SYSTEM_CONNECTION_STRING)
end
after do
Object.send(:remove_const, :TestUser)
Object.send(:remove_const, :TestUserRepository)
Object.send(:remove_const, :TestDevice)
Object.send(:remove_const, :TestDeviceRepository)
end
let(:collection) { :users }
it do
assert_raises(Errno::ENOENT) { @adapter.send(:read, :users) } # private - what's breaking
assert_raises(Errno::ENOENT) { @adapter.all(:users) } # public api - still breaking ;)
end
## rest of the specs commented out
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment