Sha256: fd7a86e46d339d7ddceac5b86a8e7545e1516b04af313245a8dcc6e739a0dc8d
Contents?: true
Size: 692 Bytes
Versions: 15
Compression:
Stored size: 692 Bytes
Contents
require 'spec_helper' describe "Cistern::Singular" do class SampleSingular < Cistern::Singular attribute :name attribute :count, type: :number def fetch_attributes #test that initialize waits for service to be defined raise "missing service" unless service @counter ||= 0 @counter += 1 {name: "amazing", count: @counter} end end it "should work" do expect(SampleSingular.new(service: :fake).name).to eq("amazing") end it "should reload" do singular = SampleSingular.new(service: :fake) old_count = singular.count expect(singular.count).to eq(old_count) expect(singular.reload.count).to be > old_count end end
Version data entries
15 entries across 15 versions & 1 rubygems