Sha256: c183904bc9111470c431b3bb4ab482179a81b889656c0cba5a7945cd8ceecc92

Contents?: true

Size: 640 Bytes

Versions: 23

Compression:

Stored size: 640 Bytes

Contents

require 'spec_helper'

describe Resource::Response::Property do
  class Customer
    attr_accessor :login
  end

  subject {Resource::Property.new(:login)}

  it "returns a pair with property name and value" do
    customer = Customer.new.tap {|c| c.login = "jackiechan2010"}
    subject.to_resource(customer).should == {login: "jackiechan2010"}
  end

  context "when this key shouldn't be visible on resource" do
    it "returns an empty hash" do
      subject.should_receive(:visible?).and_return false
      customer = Customer.new.tap {|c| c.login = "jackiechan2010"}
      subject.to_resource(customer).should == {}
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
transcriber-0.0.5 spec/unit/resource/response/property_spec.rb
transcriber-0.0.4 spec/unit/resource/response/property_spec.rb
transcriber-0.0.3 spec/unit/resource/response/property_spec.rb