Sha256: 497bc8951eb770417722b4e452de05c995c2bb1fe384e840a3f8e92d3749183f
Contents?: true
Size: 1.21 KB
Versions: 2
Compression:
Stored size: 1.21 KB
Contents
require 'spec_helper' describe ApiClient::Base do describe "#initialize" do context "with a hash {:a => 'a', :b => 'b'}" do before :each do @user = User.new({:a => "a", :b => "b"}) end it "should set #a" do @user.a.should == "a" end it "should set #b" do @user.b.should == "b" end end end describe "#persisted?" do it "should return false" do User.new.should_not be_persisted end end describe "#errors" do context "when @errors is not nil" do before :each do @user = User.new(:errors => {:a => :bc}) end it "should return the errors" do @user.errors.should == {:a => :bc} end end context "when @errors is nil" do before :each do @user = User.new end it "should instantiate a new instance of ApiClient::Errors" do @user.errors.should be_an_instance_of(ApiClient::Errors) end end end describe "#errors=" do before :each do @user = User.new(:errors => { "a" => "message", "b" => "message" }) end it "should set @errors with symbolic keys" do @user.errors.should == { :a => "message", :b => "message" } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
api-client-1.5.0 | spec/api-client/base_spec.rb |
api-client-1.4.1 | spec/api-client/base_spec.rb |