Sha256: 981914879325bb572cfcc4f08a62252139803b420ee6f667da0186e27c9d1b56

Contents?: true

Size: 1.71 KB

Versions: 21

Compression:

Stored size: 1.71 KB

Contents

require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'helper'))

context "respond to reviews" do
  set :vcr, false
  r = rand(1000)
  context "try to add response" do
    setup do
      SessionHelper.sales_coord.call_api CityGrid::API::Content::Response,
        :mutate,
        "mutateOperationListResource" => [{
          "operator" => "ADD",
          "operand" => {
            "reviewId" => 22772891,
            "text" => "comment text blue"
          }
          }]
    end
    should ("not be empty") { !topic.empty? }
    should ("already have a comment") { topic.reviews[0].responseStatus.message == "The review has already comment from the merchant." }
  end
  
  context "edit response" do
    setup do
      SessionHelper.sales_coord.call_api CityGrid::API::Content::Response,
        :mutate,
        "mutateOperationListResource" => [{
          "operator" => "SET",
          "operand" => {
            "reviewId" => 22772891,
            "text" => "comment text #{r}"
          }
          }]
    end
    should ("not be empty") { !topic.empty? }
    should ("be ok") { topic.reviews[0].responseStatus.message == "OK" }
    should ("have correct comment") { topic.reviews[0].userComments == "comment text #{r}"}
    should ("have review text") { !topic.reviews[0].review.text.empty?}
  end
  
  context "get response" do
    setup do
      SessionHelper.sales_coord.call_api CityGrid::API::Content::Response,
        :get,
        :reviewId => 22772891
    end
    should ("not be empty") { !topic.empty? }
    should ("be ok") { topic.response.code == 200 }
    should ("have correct comment") { topic.comments[0].text == "comment text #{r}"}
    should ("have review text") { !topic.review.text.empty?}
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
citygrid_api-0.0.28 test/api/content/test_response.rb
citygrid_api-0.0.27 test/api/content/test_response.rb
citygrid_api-0.0.26 test/api/content/test_response.rb
citygrid_api-0.0.25 test/api/content/test_response.rb
citygrid_api-0.0.24 test/api/content/test_response.rb
citygrid_api-0.0.23 test/api/content/test_response.rb
citygrid_api-0.0.22 test/api/content/test_response.rb
citygrid_api-0.0.21 test/api/content/test_response.rb
citygrid_api-0.0.20 test/api/content/test_response.rb
citygrid_api-0.0.19 test/api/content/test_response.rb
citygrid_api-0.0.18 test/api/content/test_response.rb
citygrid_api-0.0.17 test/api/content/test_response.rb
citygrid_api-0.0.16 test/api/content/test_response.rb
citygrid_api-0.0.15 test/api/content/test_response.rb
citygrid_api-0.0.14 test/api/content/test_response.rb
citygrid_api-0.0.13 test/api/content/test_response.rb
citygrid_api-0.0.12 test/api/content/test_response.rb
citygrid_api-0.0.11 test/api/content/test_response.rb
citygrid_api-0.0.10 test/api/content/test_response.rb
citygrid_api-0.0.9 test/api/content/test_response.rb