Sha256: 750100c5e35e6bf9190026b3ec672dc426912c0360292ea2606459c460db4d18

Contents?: true

Size: 824 Bytes

Versions: 10

Compression:

Stored size: 824 Bytes

Contents

require 'spec_helper'

describe ItemsController do
  
  context "when creating an item" do

    it "should keep its values" do
      p = Restfulie.at('http://localhost:3000/items').as("application/xml").post("<item><name>Agile Training</name><price>500</price></item>")
      p.item.name.should == "Agile Training"
      p.item.price.should == 500
    end

  end

  context "when retrieving data" do
    it "should retrieve one single element" do
      p = Restfulie.at('http://localhost:3000/items/1').get
      p.item.name.should == "Rest in practice"
      p.item.price.should == 400
    end
    
    it "should retrieve an array" do
      p = Restfulie.at('http://localhost:3000/items').get
      p.items.item[0].name.should == "Rest in practice"
      p.items.item[0].price.should == "400.0"
    end
    
  end
  
end

Version data entries

10 entries across 5 versions & 2 rubygems

Version Path
restfulie-nosqlite-1.0.4 full-examples/rest_from_scratch/part_2/spec/items_spec.rb
restfulie-nosqlite-1.0.4 full-examples/rest_from_scratch/part_3/spec/items_spec.rb
restfulie-1.1.1 full-examples/rest_from_scratch/part_3/spec/items_spec.rb
restfulie-1.1.1 full-examples/rest_from_scratch/part_2/spec/items_spec.rb
restfulie-1.1.0 full-examples/rest_from_scratch/part_2/spec/items_spec.rb
restfulie-1.1.0 full-examples/rest_from_scratch/part_3/spec/items_spec.rb
restfulie-nosqlite-1.0.3 full-examples/rest_from_scratch/part_2/spec/items_spec.rb
restfulie-nosqlite-1.0.3 full-examples/rest_from_scratch/part_3/spec/items_spec.rb
restfulie-1.0.3 full-examples/rest_from_scratch/part_3/spec/items_spec.rb
restfulie-1.0.3 full-examples/rest_from_scratch/part_2/spec/items_spec.rb