spree_api 1.2.5 → 1.3.0.rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. data/.rspec +1 -0
  2. data/app/controllers/spree/api/addresses_controller.rb +17 -0
  3. data/app/controllers/spree/api/base_controller.rb +111 -0
  4. data/app/controllers/spree/api/countries_controller.rb +14 -0
  5. data/app/controllers/spree/api/images_controller.rb +29 -0
  6. data/app/controllers/spree/api/line_items_controller.rb +38 -0
  7. data/app/controllers/spree/api/orders_controller.rb +81 -0
  8. data/app/controllers/spree/api/payments_controller.rb +75 -0
  9. data/app/controllers/spree/api/product_properties_controller.rb +61 -0
  10. data/app/controllers/spree/api/products_controller.rb +45 -0
  11. data/app/controllers/spree/api/return_authorizations_controller.rb +50 -0
  12. data/app/controllers/spree/api/shipments_controller.rb +41 -0
  13. data/app/controllers/spree/api/taxonomies_controller.rb +46 -0
  14. data/app/controllers/spree/api/taxons_controller.rb +49 -0
  15. data/app/controllers/spree/api/variants_controller.rb +71 -0
  16. data/app/controllers/spree/api/zones_controller.rb +43 -0
  17. data/app/helpers/spree/api/api_helpers.rb +0 -5
  18. data/app/overrides/api_admin_user_edit_form.rb +1 -1
  19. data/app/views/spree/admin/users/_api_fields.html.erb +26 -14
  20. data/app/views/spree/api/{v1/addresses/show.rabl → addresses/show.v1.rabl} +0 -0
  21. data/app/views/spree/api/{v1/countries/index.rabl → countries/index.v1.rabl} +0 -0
  22. data/app/views/spree/api/{v1/countries/show.rabl → countries/show.v1.rabl} +0 -0
  23. data/app/views/spree/api/{v1/errors/gateway_error.rabl → errors/gateway_error.v1.rabl} +0 -0
  24. data/app/views/spree/api/{v1/errors/invalid_api_key.rabl → errors/invalid_api_key.v1.rabl} +0 -0
  25. data/app/views/spree/api/{v1/errors/invalid_resource.rabl → errors/invalid_resource.v1.rabl} +0 -0
  26. data/app/views/spree/api/{v1/errors/must_specify_api_key.rabl → errors/must_specify_api_key.v1.rabl} +0 -0
  27. data/app/views/spree/api/{v1/errors/not_found.rabl → errors/not_found.v1.rabl} +0 -0
  28. data/app/views/spree/api/{v1/errors/unauthorized.rabl → errors/unauthorized.v1.rabl} +0 -0
  29. data/app/views/spree/api/{v1/images/show.rabl → images/show.v1.rabl} +0 -0
  30. data/app/views/spree/api/{v1/line_items/new.rabl → line_items/new.v1.rabl} +0 -0
  31. data/app/views/spree/api/{v1/line_items/show.rabl → line_items/show.v1.rabl} +1 -1
  32. data/app/views/spree/api/{v1/orders/address.rabl → orders/address.v1.rabl} +0 -0
  33. data/app/views/spree/api/{v1/orders/canceled.rabl → orders/canceled.v1.rabl} +0 -0
  34. data/app/views/spree/api/{v1/orders/cart.rabl → orders/cart.v1.rabl} +0 -0
  35. data/app/views/spree/api/{v1/orders/complete.rabl → orders/complete.v1.rabl} +0 -0
  36. data/app/views/spree/api/{v1/orders/could_not_transition.rabl → orders/could_not_transition.v1.rabl} +0 -0
  37. data/app/views/spree/api/{v1/orders/delivery.rabl → orders/delivery.v1.rabl} +0 -0
  38. data/app/views/spree/api/{v1/orders/index.rabl → orders/index.v1.rabl} +0 -0
  39. data/app/views/spree/api/{v1/orders/invalid_shipping_method.rabl → orders/invalid_shipping_method.v1.rabl} +0 -0
  40. data/app/views/spree/api/{v1/orders/payment.rabl → orders/payment.v1.rabl} +0 -0
  41. data/app/views/spree/api/{v1/orders/show.rabl → orders/show.v1.rabl} +6 -6
  42. data/app/views/spree/api/{v1/payments/credit_over_limit.rabl → payments/credit_over_limit.v1.rabl} +0 -0
  43. data/app/views/spree/api/{v1/payments/index.rabl → payments/index.v1.rabl} +0 -0
  44. data/app/views/spree/api/{v1/payments/new.rabl → payments/new.v1.rabl} +0 -0
  45. data/app/views/spree/api/{v1/payments/show.rabl → payments/show.v1.rabl} +0 -0
  46. data/app/views/spree/api/{v1/product_properties/index.rabl → product_properties/index.v1.rabl} +0 -0
  47. data/app/views/spree/api/{v1/product_properties/new.rabl → product_properties/new.v1.rabl} +0 -0
  48. data/app/views/spree/api/{v1/product_properties/show.rabl → product_properties/show.v1.rabl} +0 -0
  49. data/app/views/spree/api/{v1/products/index.rabl → products/index.v1.rabl} +1 -2
  50. data/app/views/spree/api/{v1/products/new.rabl → products/new.v1.rabl} +0 -0
  51. data/app/views/spree/api/{v1/products/product.rabl → products/product.v1.rabl} +0 -0
  52. data/app/views/spree/api/{v1/products/show.rabl → products/show.v1.rabl} +1 -1
  53. data/app/views/spree/api/{v1/return_authorizations/index.rabl → return_authorizations/index.v1.rabl} +0 -0
  54. data/app/views/spree/api/{v1/return_authorizations/new.rabl → return_authorizations/new.v1.rabl} +0 -0
  55. data/app/views/spree/api/{v1/return_authorizations/show.rabl → return_authorizations/show.v1.rabl} +0 -0
  56. data/app/views/spree/api/{v1/shipments/cannot_ready_shipment.rabl → shipments/cannot_ready_shipment.v1.rabl} +0 -0
  57. data/app/views/spree/api/{v1/shipments/show.rabl → shipments/show.v1.rabl} +0 -0
  58. data/app/views/spree/api/{v1/taxonomies/index.rabl → taxonomies/index.v1.rabl} +1 -1
  59. data/app/views/spree/api/{v1/taxonomies/nested.rabl → taxonomies/nested.v1.rabl} +1 -1
  60. data/app/views/spree/api/{v1/taxonomies/new.rabl → taxonomies/new.v1.rabl} +0 -0
  61. data/app/views/spree/api/{v1/taxonomies/show.rabl → taxonomies/show.v1.rabl} +1 -1
  62. data/app/views/spree/api/{v1/taxons/index.rabl → taxons/index.v1.rabl} +1 -1
  63. data/app/views/spree/api/{v1/taxons/new.rabl → taxons/new.v1.rabl} +0 -0
  64. data/app/views/spree/api/{v1/taxons/show.rabl → taxons/show.v1.rabl} +0 -0
  65. data/app/views/spree/api/{v1/taxons/taxons.rabl → taxons/taxons.v1.rabl} +1 -1
  66. data/app/views/spree/api/{v1/variants/index.rabl → variants/index.v1.rabl} +0 -0
  67. data/app/views/spree/api/{v1/variants/new.rabl → variants/new.v1.rabl} +0 -0
  68. data/app/views/spree/api/{v1/variants/show.rabl → variants/show.v1.rabl} +1 -1
  69. data/app/views/spree/api/{v1/variants/variant.rabl → variants/variant.v1.rabl} +0 -0
  70. data/app/views/spree/api/{v1/zones/index.rabl → zones/index.v1.rabl} +1 -1
  71. data/app/views/spree/api/{v1/zones/show.rabl → zones/show.v1.rabl} +0 -0
  72. data/config/initializers/metal_load_paths.rb +1 -1
  73. data/config/routes.rb +34 -37
  74. data/db/migrate/20120411123334_resize_api_key_field.rb +1 -1
  75. data/lib/spree/api/engine.rb +8 -1
  76. data/lib/spree_api.rb +1 -0
  77. data/spec/controllers/spree/api/{v1/addresses_controller_spec.rb → addresses_controller_spec.rb} +3 -3
  78. data/spec/controllers/spree/api/{v1/base_controller_spec.rb → base_controller_spec.rb} +2 -9
  79. data/spec/controllers/spree/api/{v1/countries_controller_spec.rb → countries_controller_spec.rb} +5 -5
  80. data/spec/controllers/spree/api/{v1/images_controller_spec.rb → images_controller_spec.rb} +1 -1
  81. data/spec/controllers/spree/api/{v1/line_items_controller_spec.rb → line_items_controller_spec.rb} +2 -2
  82. data/spec/controllers/spree/api/{v1/orders_controller_spec.rb → orders_controller_spec.rb} +7 -12
  83. data/spec/controllers/spree/api/{v1/payments_controller_spec.rb → payments_controller_spec.rb} +2 -2
  84. data/spec/controllers/spree/api/{v1/product_properties_controller_spec.rb → product_properties_controller_spec.rb} +2 -3
  85. data/spec/controllers/spree/api/{v1/products_controller_spec.rb → products_controller_spec.rb} +14 -7
  86. data/spec/controllers/spree/api/{v1/return_authorizations_controller_spec.rb → return_authorizations_controller_spec.rb} +4 -4
  87. data/spec/controllers/spree/api/{v1/shipments_controller_spec.rb → shipments_controller_spec.rb} +4 -9
  88. data/spec/controllers/spree/api/{v1/taxonomies_controller_spec.rb → taxonomies_controller_spec.rb} +11 -11
  89. data/spec/controllers/spree/api/{v1/taxons_controller_spec.rb → taxons_controller_spec.rb} +7 -7
  90. data/spec/controllers/spree/api/{v1/unauthenticated_products_controller_spec.rb → unauthenticated_products_controller_spec.rb} +1 -1
  91. data/spec/controllers/spree/api/{v1/variants_controller_spec.rb → variants_controller_spec.rb} +4 -5
  92. data/spec/controllers/spree/api/{v1/zones_controller_spec.rb → zones_controller_spec.rb} +7 -7
  93. data/spec/support/controller_hacks.rb +1 -1
  94. data/spec/support/have_attributes_matcher.rb +2 -2
  95. data/spree_api.gemspec +1 -0
  96. metadata +139 -115
  97. checksums.yaml +0 -7
  98. data/app/controllers/spree/api/v1/addresses_controller.rb +0 -19
  99. data/app/controllers/spree/api/v1/base_controller.rb +0 -111
  100. data/app/controllers/spree/api/v1/countries_controller.rb +0 -18
  101. data/app/controllers/spree/api/v1/images_controller.rb +0 -32
  102. data/app/controllers/spree/api/v1/inventory_units_controller.rb +0 -50
  103. data/app/controllers/spree/api/v1/line_items_controller.rb +0 -40
  104. data/app/controllers/spree/api/v1/orders_controller.rb +0 -83
  105. data/app/controllers/spree/api/v1/payments_controller.rb +0 -77
  106. data/app/controllers/spree/api/v1/product_properties_controller.rb +0 -64
  107. data/app/controllers/spree/api/v1/products_controller.rb +0 -47
  108. data/app/controllers/spree/api/v1/return_authorizations_controller.rb +0 -53
  109. data/app/controllers/spree/api/v1/shipments_controller.rb +0 -43
  110. data/app/controllers/spree/api/v1/taxonomies_controller.rb +0 -50
  111. data/app/controllers/spree/api/v1/taxons_controller.rb +0 -51
  112. data/app/controllers/spree/api/v1/variants_controller.rb +0 -74
  113. data/app/controllers/spree/api/v1/zones_controller.rb +0 -45
  114. data/app/views/spree/api/v1/inventory_units/show.rabl +0 -2
  115. data/spec/controllers/spree/api/v1/inventory_units_controller_spec.rb +0 -46
@@ -4,6 +4,5 @@ node(:total_count) { @products.total_count }
4
4
  node(:current_page) { params[:page] ? params[:page].to_i : 1 }
5
5
  node(:pages) { @products.num_pages }
6
6
  child(@products) do
7
- extends "spree/api/v1/products/show"
7
+ extends "spree/api/products/show"
8
8
  end
9
-
@@ -9,7 +9,7 @@ child :variants_including_master => :variants do
9
9
  end
10
10
 
11
11
  child :images => :images do
12
- extends "spree/api/v1/images/show"
12
+ extends "spree/api/images/show"
13
13
  end
14
14
 
15
15
  child :option_types => :option_types do
@@ -1,6 +1,6 @@
1
1
  object false
2
2
  child(@taxonomies => :taxonomies) do
3
- extends "spree/api/v1/taxonomies/show"
3
+ extends "spree/api/taxonomies/show"
4
4
  end
5
5
  node(:count) { @taxonomies.count }
6
6
  node(:current_page) { params[:page] || 1 }
@@ -6,6 +6,6 @@ child :root => :root do
6
6
  child :children => :taxons do
7
7
  attributes *taxon_attributes
8
8
 
9
- extends "spree/api/v1/taxons/taxons"
9
+ extends "spree/api/taxons/taxons"
10
10
  end
11
11
  end
@@ -1,7 +1,7 @@
1
1
  object @taxonomy
2
2
 
3
3
  if set = params[:set]
4
- extends "spree/api/v1/taxonomies/#{set}"
4
+ extends "spree/api/taxonomies/#{set}"
5
5
  else
6
6
  attributes *taxonomy_attributes
7
7
 
@@ -1,4 +1,4 @@
1
1
  collection @taxons
2
2
  attributes *taxon_attributes
3
3
 
4
- extends "spree/api/v1/taxons/taxons"
4
+ extends "spree/api/taxons/taxons"
@@ -2,6 +2,6 @@ node do |t|
2
2
  child t.children => :taxons do
3
3
  attributes *taxon_attributes
4
4
 
5
- extends "spree/api/v1/taxons/taxons"
5
+ extends "spree/api/taxons/taxons"
6
6
  end
7
7
  end
@@ -1,3 +1,3 @@
1
1
  object @variant
2
- extends "spree/api/v1/variants/variant"
2
+ extends "spree/api/variants/variant"
3
3
  child(:option_values => :option_values) { attributes *option_value_attributes }
@@ -1,6 +1,6 @@
1
1
  object false
2
2
  child(@zones => :zones) do
3
- extends 'spree/api/v1/zones/show'
3
+ extends 'spree/api/zones/show'
4
4
  end
5
5
  node(:count) { @zones.count }
6
6
  node(:current_page) { params[:page] || 1 }
@@ -1 +1 @@
1
- Spree::Api::V1::BaseController.append_view_path(ApplicationController.view_paths)
1
+ Spree::Api::BaseController.append_view_path(ApplicationController.view_paths)
@@ -1,4 +1,4 @@
1
- Spree::Core::Engine.routes.draw do
1
+ Spree::Core::Engine.routes.prepend do
2
2
  namespace :admin do
3
3
  resources :users do
4
4
  member do
@@ -9,51 +9,48 @@ Spree::Core::Engine.routes.draw do
9
9
  end
10
10
 
11
11
  namespace :api do
12
- scope :module => :v1 do
13
- resources :products do
14
- resources :variants
15
- resources :product_properties
16
- end
12
+ resources :products do
13
+ resources :variants
14
+ resources :product_properties
15
+ end
16
+
17
+ resources :images
18
+ resources :variants, :only => [:index] do
19
+ end
17
20
 
18
- resources :images
19
- resources :variants, :only => [:index] do
21
+ resources :orders do
22
+ resources :return_authorizations
23
+ member do
24
+ put :address
25
+ put :delivery
26
+ put :cancel
27
+ put :empty
20
28
  end
21
29
 
22
- resources :orders do
23
- resources :return_authorizations
30
+ resources :line_items
31
+ resources :payments do
24
32
  member do
25
- put :address
26
- put :delivery
27
- put :cancel
28
- put :empty
29
- end
30
-
31
- resources :line_items
32
- resources :payments do
33
- member do
34
- put :authorize
35
- put :capture
36
- put :purchase
37
- put :void
38
- put :credit
39
- end
33
+ put :authorize
34
+ put :capture
35
+ put :purchase
36
+ put :void
37
+ put :credit
40
38
  end
39
+ end
41
40
 
42
- resources :shipments do
43
- member do
44
- put :ready
45
- put :ship
46
- end
41
+ resources :shipments do
42
+ member do
43
+ put :ready
44
+ put :ship
47
45
  end
48
46
  end
47
+ end
49
48
 
50
- resources :zones
51
- resources :countries, :only => [:index, :show]
52
- resources :addresses, :only => [:show, :update]
53
- resources :taxonomies do
54
- resources :taxons
55
- end
56
- resources :inventory_units, :only => [:show, :update]
49
+ resources :zones
50
+ resources :countries, :only => [:index, :show]
51
+ resources :addresses, :only => [:show, :update]
52
+ resources :taxonomies do
53
+ resources :taxons
57
54
  end
58
55
  end
59
56
  end
@@ -1,6 +1,6 @@
1
1
  class ResizeApiKeyField < ActiveRecord::Migration
2
2
  def change
3
- unless defined?(User)
3
+ unless defined?(User)
4
4
  change_column :spree_users, :api_key, :string, :limit => 48
5
5
  end
6
6
  end
@@ -6,6 +6,14 @@ module Spree
6
6
  isolate_namespace Spree
7
7
  engine_name 'spree_api'
8
8
 
9
+ Rabl.configure do |config|
10
+ config.include_json_root = false
11
+ config.include_child_root = false
12
+ end
13
+
14
+ config.view_versions = [1]
15
+ config.view_version_extraction_strategy = :http_header
16
+
9
17
  initializer "spree.api.environment", :before => :load_config_initializers do |app|
10
18
  Spree::Api::Config = Spree::ApiConfiguration.new
11
19
  end
@@ -20,7 +28,6 @@ module Spree
20
28
  def self.root
21
29
  @root ||= Pathname.new(File.expand_path('../../../../', __FILE__))
22
30
  end
23
-
24
31
  end
25
32
  end
26
33
  end
@@ -1 +1,2 @@
1
1
  require 'spree/api'
2
+ require 'versioncake'
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  module Spree
4
- describe Api::V1::AddressesController do
4
+ describe Api::AddressesController do
5
5
  render_views
6
6
 
7
7
  before do
@@ -16,13 +16,13 @@ module Spree
16
16
 
17
17
  it "gets an address" do
18
18
  api_get :show, :id => @address.id
19
- json_response['address']['address1'].should eq @address.address1
19
+ json_response['address1'].should eq @address.address1
20
20
  end
21
21
 
22
22
  it "updates an address" do
23
23
  api_put :update, :id => @address.id,
24
24
  :address => { :address1 => "123 Test Lane" }
25
- json_response['address']['address1'].should eq '123 Test Lane'
25
+ json_response['address1'].should eq '123 Test Lane'
26
26
  end
27
27
  end
28
28
 
@@ -1,8 +1,8 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Spree::Api::V1::BaseController do
3
+ describe Spree::Api::BaseController do
4
4
  render_views
5
- controller(Spree::Api::V1::BaseController) do
5
+ controller(Spree::Api::BaseController) do
6
6
  def index
7
7
  render :json => { "products" => [] }
8
8
  end
@@ -28,13 +28,6 @@ describe Spree::Api::V1::BaseController do
28
28
  end
29
29
  end
30
30
 
31
- it 'handles exceptions' do
32
- subject.should_receive(:authenticate_user).and_return(true)
33
- subject.should_receive(:index).and_raise(Exception.new("no joy"))
34
- get :index, :token => "fake_key"
35
- json_response.should == { "exception" => "no joy" }
36
- end
37
-
38
31
  it "maps symantec keys to nested_attributes keys" do
39
32
  klass = stub(:nested_attributes_options => { :line_items => {},
40
33
  :bill_address => {} })
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  module Spree
4
- describe Api::V1::CountriesController do
4
+ describe Api::CountriesController do
5
5
  render_views
6
6
 
7
7
  before do
@@ -12,7 +12,7 @@ module Spree
12
12
 
13
13
  it "gets all countries" do
14
14
  api_get :index
15
- json_response["countries"].first['country']['iso3'].should eq @country.iso3
15
+ json_response['countries'].first['iso3'].should eq @country.iso3
16
16
  end
17
17
 
18
18
  context "with two countries" do
@@ -28,7 +28,7 @@ module Spree
28
28
  it 'can query the results through a paramter' do
29
29
  api_get :index, :q => { :name_cont => 'zam' }
30
30
  json_response['count'].should == 1
31
- json_response['countries'].first['country']['name'].should eq @zambia.name
31
+ json_response['countries'].first['name'].should eq @zambia.name
32
32
  end
33
33
 
34
34
  it 'can control the page size through a parameter' do
@@ -41,8 +41,8 @@ module Spree
41
41
 
42
42
  it "includes states" do
43
43
  api_get :show, :id => @country.id
44
- states = json_response['country']['states']
45
- states.first['state']['name'].should eq @state.name
44
+ states = json_response['states']
45
+ states.first['name'].should eq @state.name
46
46
  end
47
47
  end
48
48
  end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  module Spree
4
- describe Spree::Api::V1::ImagesController do
4
+ describe Spree::Api::ImagesController do
5
5
  render_views
6
6
 
7
7
  let!(:product) { create(:product) }
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  module Spree
4
- describe Api::V1::LineItemsController do
4
+ describe Api::LineItemsController do
5
5
  render_views
6
6
 
7
7
  let!(:order) do
@@ -34,7 +34,7 @@ module Spree
34
34
  api_post :create, :line_item => { :variant_id => product.master.to_param, :quantity => 1 }
35
35
  response.status.should == 201
36
36
  json_response.should have_attributes(attributes)
37
- json_response["line_item"]["variant"]["name"].should_not be_blank
37
+ json_response["variant"]["name"].should_not be_blank
38
38
  end
39
39
 
40
40
  it "can update a line item on the order" do
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  module Spree
4
- describe Api::V1::OrdersController do
4
+ describe Api::OrdersController do
5
5
  render_views
6
6
 
7
7
  let!(:order) { create(:order) }
@@ -66,14 +66,14 @@ module Spree
66
66
  order.line_items.count.should == 1
67
67
  order.line_items.first.variant.should == variant
68
68
  order.line_items.first.quantity.should == 5
69
- json_response["order"]["state"].should == "address"
69
+ json_response["state"].should == "address"
70
70
  end
71
71
 
72
72
  it "can create an order without any parameters" do
73
73
  lambda { api_post :create }.should_not raise_error(NoMethodError)
74
74
  response.status.should == 201
75
75
  order = Order.last
76
- json_response["order"]["state"].should == "address"
76
+ json_response["state"].should == "address"
77
77
  end
78
78
 
79
79
  context "working with an order" do
@@ -108,7 +108,7 @@ module Spree
108
108
  order.shipping_address.firstname.should == shipping_address[:firstname]
109
109
  order.billing_address.firstname.should == billing_address[:firstname]
110
110
  order.state.should == "delivery"
111
- json_response["order"]["shipping_methods"].should_not be_empty
111
+ json_response["shipping_methods"].should_not be_empty
112
112
  end
113
113
 
114
114
  it "can add just shipping address information to an order" do
@@ -147,7 +147,7 @@ module Spree
147
147
  api_put :update, :id => order.to_param, :order => { :line_items => [{:variant_id => create(:variant).id, :quantity => 2}] }
148
148
 
149
149
  response.status.should == 200
150
- json_response['order']['item_total'].to_f.should_not == order.item_total.to_f
150
+ json_response['item_total'].to_f.should_not == order.item_total.to_f
151
151
  end
152
152
 
153
153
  context "with a line item" do
@@ -230,7 +230,7 @@ module Spree
230
230
  api_get :index, :q => { :email_cont => 'spree' }
231
231
  json_response["orders"].count.should == 1
232
232
  json_response["orders"].first.should have_attributes(attributes)
233
- json_response["orders"].first["order"]["email"].should == expected_result.email
233
+ json_response["orders"].first["email"].should == expected_result.email
234
234
  json_response["count"].should == 1
235
235
  json_response["current_page"].should == 1
236
236
  json_response["pages"].should == 1
@@ -239,11 +239,6 @@ module Spree
239
239
 
240
240
  context "can cancel an order" do
241
241
  before do
242
- Spree::MailMethod.create!(
243
- :environment => Rails.env,
244
- :preferred_mails_from => "spree@example.com"
245
- )
246
-
247
242
  order.completed_at = Time.now
248
243
  order.state = 'complete'
249
244
  order.shipment_state = 'ready'
@@ -252,7 +247,7 @@ module Spree
252
247
 
253
248
  specify do
254
249
  api_put :cancel, :id => order.to_param
255
- json_response["order"]["state"].should == "canceled"
250
+ json_response["state"].should == "canceled"
256
251
  end
257
252
  end
258
253
  end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  module Spree
4
- describe Spree::Api::V1::PaymentsController do
4
+ describe Spree::Api::PaymentsController do
5
5
  render_views
6
6
  let!(:order) { create(:order) }
7
7
  let!(:payment) { create(:payment, :order => order) }
@@ -88,7 +88,7 @@ module Spree
88
88
  it 'can query the results through a paramter' do
89
89
  api_get :index, :q => { :response_code_cont => '999' }
90
90
  json_response['count'].should == 1
91
- json_response['payments'].first['payment']['response_code'].should eq @payment.response_code
91
+ json_response['payments'].first['response_code'].should eq @payment.response_code
92
92
  end
93
93
  end
94
94