Sha256: c03406feef5f77948264773adce15693c1d748aa833b4da798ae3f06e93154eb

Contents?: true

Size: 967 Bytes

Versions: 1

Compression:

Stored size: 967 Bytes

Contents

require 'spec_helper'
require 'hibachi/store'

module Hibachi
  describe Store do
    it "creates a new model from scratch" do
      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.pre spec/hibachi/store_spec.rb