Sha256: e416653711bc9b5924fa9af5350d97e15f38a4cded0c6909662cff0cf0ffddcf
Contents?: true
Size: 1.05 KB
Versions: 5
Compression:
Stored size: 1.05 KB
Contents
require 'spec_helper' describe Mongoid::Errors::MongoidError do let(:error) { described_class.new } let(:key) { :callbacks } let(:options) { {} } before do ["message", "summary", "resolution"].each do |name| ::I18n.should_receive(:translate). with("mongoid.errors.messages.#{key}.#{name}", {}). and_return(name) end error.compose_message(key, options) end describe "#compose_message" do it "sets ivar problem" do expect(error.instance_variable_get(:@problem)).to be end it "sets ivar summary" do expect(error.instance_variable_get(:@summary)).to be end it "sets ivar resolution" do expect(error.instance_variable_get(:@resolution)).to be end end describe "#to_json" do it "has problem" do expect(error.to_json).to include('"problem":"message"') end it "has summary" do expect(error.to_json).to include('"summary":"summary"') end it "has resolution" do expect(error.to_json).to include('"resolution":"resolution"') end end end
Version data entries
5 entries across 5 versions & 4 rubygems