Sha256: af53495b4aad442a5438dfd4cb630a6836087006883aaddd249b48fc65a1198f
Contents?: true
Size: 1.06 KB
Versions: 1
Compression:
Stored size: 1.06 KB
Contents
require 'spec_helper' require 'hibachi/persistence' module Hibachi describe Persistence do it "creates a new model from scratch" do expect(MockSetting.recipe_name).to eq(:mock_settings) expect(MockSetting).to be_singleton setting = MockSetting.create(name: 'from-scratch') expect(setting).to be_persisted expect(setting.destroy).to eq(true) end it "finds all of this type in the json" do setting = MockSetting.find 'test' expect(setting).to be_present end it "searches for a given model in the json" do settings = MockSetting.where(name: 'test') expect(settings).to_not be_empty expect(settings.first.name).to eq('test') end context "with an instance" do subject { MockSetting.new name: 'store' } it "validates given attributes" do expect(subject).to be_valid, subject.errors.full_messages.join(', ') end it "creates a new setting in the database" do expect(subject.save).to eq(true) end after { subject.destroy } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hibachi-0.0.1 | spec/hibachi/persistence_spec.rb |