spec/resources/client_spec.rb in sk-api-1.0.6 vs spec/resources/client_spec.rb in sk-api-1.1.0
- old
+ new
@@ -1,6 +1,6 @@
-require "#{File.dirname(__FILE__)}/../spec_helper"
+require 'spec/spec_helper'
describe SKApi::Resources::Client, "in general" do
before :all do
#setup test client to work with
@@ -57,13 +57,14 @@
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 = Rufus::Json.decode(json)
+ obj = ActiveSupport::JSON.decode(json)
+# puts obj['client']['organisation']
lambda {
- JSON::Schema.validate(obj, SKApi::Resources::Client.schema)
+ 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)
@@ -81,9 +82,10 @@
before :all do
#setup test client to work with
@client = SKApi::Resources::Client.new(:organisation=>'Second from testing API2',
:addresses => [{ :zip => '50374', :city => 'Cologne' }] )
+
@client.save
end
after :all do
@client.destroy
\ No newline at end of file