spec/fake_client_spec.rb in nsisam-0.6.1 vs spec/fake_client_spec.rb in nsisam-0.6.2

- old
+ new

@@ -6,12 +6,12 @@ end it "can store a value" do response = @nsisam.store("something") response.should_not be_nil - response.should have_key("key") - response.should have_key("checksum") + response.key.should_not be_nil + response.checksum.should_not be_nil end it "can store a file" do response = @nsisam.store_file("some file not in base64") response.should_not be_nil @@ -19,12 +19,12 @@ response.checksum.should_not be_nil end it "can delete a stored value" do resp = @nsisam.store("delete this") - response = @nsisam.delete(resp["key"]) - response["deleted"].should be_true + response = @nsisam.delete(resp.key) + response.should be_deleted end it "raises error when key not found" do expect { @nsisam.delete("i dont exist") }.to raise_error(NSISam::Errors::Client::KeyNotFoundError) @@ -36,23 +36,23 @@ raise_error(NSISam::Errors::Client::KeyNotFoundError) end it "can retrieve a stored value" do resp = @nsisam.store("retrieve this") - response = @nsisam.get(resp['key']) - response["data"].should == "retrieve this" + response = @nsisam.get(resp.key) + response.data.should == "retrieve this" end it "can retrieve a stored file" do resp = @nsisam.store_file("file not in base64") response = @nsisam.get_file(resp.key) response.data.should_not be_nil end it "can update values in keys already stored" do resp = @nsisam.store("update this") - response = @nsisam.update(resp['key'], "updated") - response["key"].should == resp['key'] - @nsisam.get(response['key'])['data'].should == "updated" - response.should have_key("checksum") + response = @nsisam.update(resp.key, "updated") + response.key.should == resp.key + @nsisam.get(response.key).data.should == "updated" + response.checksum.should_not be_nil end end