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.25 spec/unit/resource/response/property_spec.rb
transcriber-0.0.24 spec/unit/resource/response/property_spec.rb
transcriber-0.0.23 spec/unit/resource/response/property_spec.rb
transcriber-0.0.22 spec/unit/resource/response/property_spec.rb
transcriber-0.0.21 spec/unit/resource/response/property_spec.rb
transcriber-0.0.20 spec/unit/resource/response/property_spec.rb
transcriber-0.0.19 spec/unit/resource/response/property_spec.rb
transcriber-0.0.18 spec/unit/resource/response/property_spec.rb
transcriber-0.0.17 spec/unit/resource/response/property_spec.rb
transcriber-0.0.16 spec/unit/resource/response/property_spec.rb
transcriber-0.0.15 spec/unit/resource/response/property_spec.rb
transcriber-0.0.14 spec/unit/resource/response/property_spec.rb
transcriber-0.0.13 spec/unit/resource/response/property_spec.rb
transcriber-0.0.12 spec/unit/resource/response/property_spec.rb
transcriber-0.0.11 spec/unit/resource/response/property_spec.rb
transcriber-0.0.10 spec/unit/resource/response/property_spec.rb
transcriber-0.0.9 spec/unit/resource/response/property_spec.rb
transcriber-0.0.8 spec/unit/resource/response/property_spec.rb
transcriber-0.0.7 spec/unit/resource/response/property_spec.rb
transcriber-0.0.6 spec/unit/resource/response/property_spec.rb