Sha256: c4d96690d3aa1cb12fc610b69b8279dc6fa42ad7ec151586bd6ed0277c4271b9
Contents?: true
Size: 1.5 KB
Versions: 3
Compression:
Stored size: 1.5 KB
Contents
require 'spec_helper' require 'fedux_org/stdlib/models' describe Models::BaseModel do before(:each) { Models::BaseModel.clear } it "is possible to register a message" do m1 = Models::BaseModel.new('name') Models::BaseModel.register m1 end it "is possible to find an object" do m1 = Models::BaseModel.new('name') Models::BaseModel.register m1 m_found = Models::BaseModel.find('name') expect(m1).to eq(m_found) end it "returns a string of all active instances" do Models::BaseModel.create(:name1) Models::BaseModel.create(:name2) Models::BaseModel.enable :name1 Models::BaseModel.enable :name2 result = Models::BaseModel.all_names_as_string(", ") expect(result).to eq("name1, name2") result = Models::BaseModel.all_names_as_string(": ") expect(result).to eq("name1: name2") result = Models::BaseModel.all_names_as_string expect(result).to eq("name1, name2") end it "is possible to create and register in one step" do m1 = Models::BaseModel.create('name') m_found = Models::BaseModel.find('name') expect(m1).to eq(m_found) end it "is possible to delete an object" do m1 = Models::BaseModel.create('name') m2 = Models::BaseModel.delete('name') expect(m1).to eq(m2) end it "is possible to delete all objects" do Models::BaseModel.create('name1') Models::BaseModel.create('name2') Models::BaseModel.create('name3') Models::BaseModel.clear expect(Models::BaseModel.all).to eq( [] ) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
fedux_org-stdlib-0.0.6 | spec/models/base_model_spec.rb |
fedux_org-stdlib-0.0.5 | spec/models/base_model_spec.rb |
fedux_org-stdlib-0.0.4 | spec/models/base_model_spec.rb |