Sha256: 93a847fc670c53715569ebf5f3f14b7490e064dd5d2d53fa62da8737e4b368f5

Contents?: true

Size: 945 Bytes

Versions: 7

Compression:

Stored size: 945 Bytes

Contents

steps_for :read do
  Given "a Resource that returns associated resources" do
    class Shelf
      include DataMapper::Resource
      property :id,   Integer, :serial => true
      property :name, String
      has n, :books
    end
  end

  Given "the ID of an existing Resource that has associated Resources" do
    # Assuming that resource 1 is there.
    # @type.first would do a GET; that's what we're testing
    @resource_id = 1
  end

  Given "I have all of the necessary class definitions" do
    # NO-OP because defined above
  end

  When "I GET <nested resource>/<id>" do
    @resource = Shelf.get(@resource_id)
  end

  Then "I should get the Resource" do
    @resource.should_not be_nil
    @resource.should be_an_instance_of(Shelf)
    @resource.id.should == 1
  end

  Then "the Resource will have associated Resources" do
    @resource.books.should_not be_empty
    @resource.books.first.should be_an_instance_of(Book)
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
dm-rest-adapter-0.9.9 stories/resources/steps/read.rb
dm-rest-adapter-0.9.10 stories/resources/steps/read.rb
dm-rest-adapter-0.9.4 stories/resources/steps/read.rb
dm-rest-adapter-0.9.5 stories/resources/steps/read.rb
dm-rest-adapter-0.9.6 stories/resources/steps/read.rb
dm-rest-adapter-0.9.7 stories/resources/steps/read.rb
dm-rest-adapter-0.9.8 stories/resources/steps/read.rb