Sha256: 3235d16e29b2a671c24a0aee35be1df312e7f4c215e55e6bb81b8cb65b2c82e1
Contents?: true
Size: 707 Bytes
Versions: 14
Compression:
Stored size: 707 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 connection to be defined raise "missing connection" unless connection @counter ||= 0 @counter += 1 {name: "amazing", count: @counter} end end it "should work" do expect(SampleSingular.new(connection: :fake).name).to eq("amazing") end it "should reload" do singular = SampleSingular.new(connection: :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
14 entries across 14 versions & 1 rubygems