spec/resources/client_spec.rb in sk-api-1.1.0 vs spec/resources/client_spec.rb in sk-api-1.1.1
- old
+ new
@@ -1,6 +1,6 @@
-require 'spec/spec_helper'
+require 'spec_helper'
describe SKApi::Resources::Client, "in general" do
before :all do
#setup test client to work with
@@ -50,31 +50,10 @@
it "should fail edit a client" do
@client.last_name = ''
@client.organisation = ''
@client.save.should == false
@client.errors.count.should == 1
- @client.errors.on_base.should == "Organisation or lastname must be present."
- end
-
- it "should validate raw json object with schema" do
- client = SKApi::Resources::Client.find(@client.id)
- # convert to json and read raw without activeresource assigning classes
- json = client.to_json
- obj = ActiveSupport::JSON.decode(json)
-# puts obj['client']['organisation']
- lambda {
- JSON::Schema.validate(obj['client'], SKApi::Resources::Client.schema)
- }.should_not raise_error
- end
-
- it "should validate raw json object with to_hash_with_schema" do
- client = SKApi::Resources::Client.find(@client.id)
- # convert to json and read raw without activeresource assigning classes
- hash_obj = SKApi::Resources::Client.to_hash_from_schema(client)
-# hash_obj.should == ''
- lambda {
- JSON::Schema.validate(hash_obj['client'], SKApi::Resources::Client.schema)
- }.should_not raise_error
+ @client.errors.full_messages.should == ["Organisation or lastname must be present."]
end
end
describe SKApi::Resources::Client, "with addresses" do
\ No newline at end of file