spec/model_spec.rb in cistern-0.11.1 vs spec/model_spec.rb in cistern-0.11.2.pre2
- old
+ new
@@ -1,10 +1,10 @@
require 'spec_helper'
describe "Cistern::Model" do
describe "#update" do
- class UpdateSpec < Cistern::Model
+ class UpdateSpec < Sample::Model
identity :id
attribute :name
attribute :properties
def save
@@ -19,11 +19,11 @@
expect(model.update(name: "karen")).to eq(name: "karen")
end
end
it "should duplicate a model" do
- class DupSpec < Cistern::Model
+ class DupSpec < Sample::Model
identity :id
attribute :name
attribute :properties
end
@@ -36,11 +36,11 @@
model.name = "anotherstring"
expect(duplicate.name).to eq("string")
end
context "attribute parsing" do
- class TypeSpec < Cistern::Model
+ class TypeSpec < Sample::Model
identity :id
attribute :name, type: :string
attribute :created_at, type: :time
attribute :flag, type: :boolean
attribute :list, type: :array
@@ -153,20 +153,20 @@
expect(TypeSpec.new({"something" => {"id" => "12"}}).attributes.keys).not_to include("something")
end
describe "#requires" do
it "should raise if attribute not provided" do
- expect { TypeSpec.new({"connection" => "fake", "something" => {"id" => "12"}}).save }.to raise_exception(ArgumentError)
+ expect { TypeSpec.new({"service" => "fake", "something" => {"id" => "12"}}).save }.to raise_exception(ArgumentError)
end
it "should raise if attribute is provided and is nil" do
- expect { TypeSpec.new({"connection" => "fake", "custom" => nil}).save }.to raise_exception(ArgumentError)
+ expect { TypeSpec.new({"service" => "fake", "custom" => nil}).save }.to raise_exception(ArgumentError)
end
end
end
context "attribute coverage info collecting", :coverage do
- class CoverageSpec < Cistern::Model
+ class CoverageSpec < Sample::Model
identity :id
attribute :used, type: :string
attribute :unused, type: :string
end