Sha256: 6b72afdd58b6349ed4d87a0c005032b91b29c331ce5119d2c48d98eefb71ddb9

Contents?: true

Size: 927 Bytes

Versions: 1

Compression:

Stored size: 927 Bytes

Contents

require "test_helper"

class WebService::NamedRequestMethodsTest < Test::Unit::TestCase
  def test_collection_actions
    expect_request Foo,
      :get, "/foos/bar",
      :return => {:status => "200", :body => "bar"}
    assert_equal "bar", Foo.get(:bar)
    
    expect_request Foo,
      :get, "/foos/bar?a=b",
      :return => {:status => "200", :body => "bar"}
    assert_equal "bar", Foo.get(:bar, :a => :b)
    
    expect_request Foo,
      :put, "/foos/bar",
      :return => {:status => "200", :body => "bar"}
    assert_equal "bar", Foo.put(:bar)
  end
  
  def test_member_actions
    foo = Foo.new("id" => 1)
    
    expect_request foo,
      :put, "/foos/1/bar",
      :return => {:status => "200", :body => "bar"}
    assert_equal "bar", foo.put(:bar)
    
    expect_request foo,
      :put, "/foos/1/bar",
      :return => {:status => "200", :body => "bar"}
    assert_equal "bar", foo.put("/bar")
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
Roman2K-web-service-0.1.1 test/web_service/named_request_methods_test.rb