Sha256: aa84e7cedfc94ca4bf0687bafe2f555f8ed639e62e383f86bb736490bf99e87e
Contents?: true
Size: 1.54 KB
Versions: 17
Compression:
Stored size: 1.54 KB
Contents
describe Frenetic::HalJson::ResponseWrapper do let(:properties) do { 'a' => 1, 'b' => 2 } end let(:wrapper) { Frenetic::HalJson::ResponseWrapper.new( properties ) } subject { wrapper } describe "#members" do subject { wrapper.members } its(:size) { should == 2 } its(:first) { should == 'a' } its(:last) { should == 'b' } end describe "#keys" do subject { wrapper.keys } it { should == wrapper.members } end describe "#each" do before do @items = [] wrapper.each do |*args| @items << args end end it { should be_a Frenetic::HalJson::ResponseWrapper } it "should iterate over each getter" do @items.should == [ ['a',1], ['b',2] ] end end describe ".define_setter" do subject { wrapper.methods(false) } it "should not create setters" do subject.none? { |name| name.to_s =~ %r{=} }.should be_true end end describe ".define_getter" do context "with a :_links property" do let(:properties) { { '_links' => 'foo' } } it "should create a :links property" do wrapper.links.should == 'foo' end end context "with a :_embedded property" do let(:properties) { { '_embedded' => 'foo' } } it "should create a :resources property" do wrapper.resources.should == 'foo' end end context "with a :_embedded property" do let(:properties) { { 'href' => 'foo' } } it "should create a :url property" do wrapper.url.should == 'foo' end end end end
Version data entries
17 entries across 17 versions & 1 rubygems