spree_api 3.1.5 → 3.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/spree/api/v1/product_properties_controller.rb +7 -10
- data/app/views/spree/api/v1/countries/index.v1.rabl +1 -1
- data/app/views/spree/api/v1/credit_cards/index.v1.rabl +1 -1
- data/app/views/spree/api/v1/orders/index.v1.rabl +1 -1
- data/app/views/spree/api/v1/orders/mine.v1.rabl +1 -1
- data/app/views/spree/api/v1/payments/index.v1.rabl +1 -1
- data/app/views/spree/api/v1/product_properties/index.v1.rabl +1 -1
- data/app/views/spree/api/v1/products/index.v1.rabl +1 -1
- data/app/views/spree/api/v1/properties/index.v1.rabl +1 -1
- data/app/views/spree/api/v1/return_authorizations/index.v1.rabl +1 -1
- data/app/views/spree/api/v1/shipments/mine.v1.rabl +1 -1
- data/app/views/spree/api/v1/states/index.v1.rabl +1 -1
- data/app/views/spree/api/v1/stock_items/index.v1.rabl +1 -1
- data/app/views/spree/api/v1/stock_locations/index.v1.rabl +1 -1
- data/app/views/spree/api/v1/stock_movements/index.v1.rabl +1 -1
- data/app/views/spree/api/v1/taxonomies/index.v1.rabl +1 -1
- data/app/views/spree/api/v1/taxons/index.v1.rabl +1 -1
- data/app/views/spree/api/v1/users/index.v1.rabl +1 -1
- data/app/views/spree/api/v1/zones/index.v1.rabl +1 -1
- data/spree_api.gemspec +1 -2
- metadata +6 -88
- data/spec/controllers/spree/api/base_controller_spec.rb +0 -96
- data/spec/controllers/spree/api/v1/addresses_controller_spec.rb +0 -56
- data/spec/controllers/spree/api/v1/checkouts_controller_spec.rb +0 -363
- data/spec/controllers/spree/api/v1/classifications_controller_spec.rb +0 -48
- data/spec/controllers/spree/api/v1/countries_controller_spec.rb +0 -48
- data/spec/controllers/spree/api/v1/credit_cards_controller_spec.rb +0 -80
- data/spec/controllers/spree/api/v1/images_controller_spec.rb +0 -115
- data/spec/controllers/spree/api/v1/inventory_units_controller_spec.rb +0 -49
- data/spec/controllers/spree/api/v1/line_items_controller_spec.rb +0 -184
- data/spec/controllers/spree/api/v1/option_types_controller_spec.rb +0 -122
- data/spec/controllers/spree/api/v1/option_values_controller_spec.rb +0 -141
- data/spec/controllers/spree/api/v1/orders_controller_spec.rb +0 -735
- data/spec/controllers/spree/api/v1/payments_controller_spec.rb +0 -234
- data/spec/controllers/spree/api/v1/product_properties_controller_spec.rb +0 -116
- data/spec/controllers/spree/api/v1/products_controller_spec.rb +0 -409
- data/spec/controllers/spree/api/v1/promotion_application_spec.rb +0 -50
- data/spec/controllers/spree/api/v1/promotions_controller_spec.rb +0 -64
- data/spec/controllers/spree/api/v1/properties_controller_spec.rb +0 -102
- data/spec/controllers/spree/api/v1/return_authorizations_controller_spec.rb +0 -161
- data/spec/controllers/spree/api/v1/shipments_controller_spec.rb +0 -187
- data/spec/controllers/spree/api/v1/states_controller_spec.rb +0 -86
- data/spec/controllers/spree/api/v1/stock_items_controller_spec.rb +0 -143
- data/spec/controllers/spree/api/v1/stock_locations_controller_spec.rb +0 -113
- data/spec/controllers/spree/api/v1/stock_movements_controller_spec.rb +0 -84
- data/spec/controllers/spree/api/v1/stores_controller_spec.rb +0 -133
- data/spec/controllers/spree/api/v1/taxonomies_controller_spec.rb +0 -114
- data/spec/controllers/spree/api/v1/taxons_controller_spec.rb +0 -177
- data/spec/controllers/spree/api/v1/unauthenticated_products_controller_spec.rb +0 -26
- data/spec/controllers/spree/api/v1/users_controller_spec.rb +0 -153
- data/spec/controllers/spree/api/v1/variants_controller_spec.rb +0 -205
- data/spec/controllers/spree/api/v1/zones_controller_spec.rb +0 -91
- data/spec/fixtures/thinking-cat.jpg +0 -0
- data/spec/models/spree/legacy_user_spec.rb +0 -19
- data/spec/requests/rabl_cache_spec.rb +0 -32
- data/spec/requests/ransackable_attributes_spec.rb +0 -79
- data/spec/requests/version_spec.rb +0 -19
- data/spec/shared_examples/protect_product_actions.rb +0 -17
- data/spec/spec_helper.rb +0 -55
- data/spec/support/controller_hacks.rb +0 -33
- data/spec/support/database_cleaner.rb +0 -14
- data/spec/support/have_attributes_matcher.rb +0 -13
@@ -1,17 +0,0 @@
|
|
1
|
-
shared_examples "modifying product actions are restricted" do
|
2
|
-
it "cannot create a new product if not an admin" do
|
3
|
-
api_post :create, :product => { :name => "Brand new product!" }
|
4
|
-
assert_unauthorized!
|
5
|
-
end
|
6
|
-
|
7
|
-
it "cannot update a product" do
|
8
|
-
api_put :update, :id => product.to_param, :product => { :name => "I hacked your store!" }
|
9
|
-
assert_unauthorized!
|
10
|
-
end
|
11
|
-
|
12
|
-
it "cannot delete a product" do
|
13
|
-
api_delete :destroy, :id => product.to_param
|
14
|
-
assert_unauthorized!
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
data/spec/spec_helper.rb
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
if ENV["COVERAGE"]
|
2
|
-
# Run Coverage report
|
3
|
-
require 'simplecov'
|
4
|
-
SimpleCov.start do
|
5
|
-
add_group 'Controllers', 'app/controllers'
|
6
|
-
add_group 'Helpers', 'app/helpers'
|
7
|
-
add_group 'Mailers', 'app/mailers'
|
8
|
-
add_group 'Models', 'app/models'
|
9
|
-
add_group 'Views', 'app/views'
|
10
|
-
add_group 'Libraries', 'lib'
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
15
|
-
ENV["RAILS_ENV"] ||= 'test'
|
16
|
-
|
17
|
-
begin
|
18
|
-
require File.expand_path("../dummy/config/environment", __FILE__)
|
19
|
-
rescue LoadError
|
20
|
-
puts "Could not load dummy application. Please ensure you have run `bundle exec rake test_app`"
|
21
|
-
exit
|
22
|
-
end
|
23
|
-
|
24
|
-
require 'rspec/rails'
|
25
|
-
require 'ffaker'
|
26
|
-
|
27
|
-
# Requires supporting ruby files with custom matchers and macros, etc,
|
28
|
-
# in spec/support/ and its subdirectories.
|
29
|
-
Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each {|f| require f}
|
30
|
-
|
31
|
-
require 'spree/testing_support/factories'
|
32
|
-
require 'spree/testing_support/preferences'
|
33
|
-
|
34
|
-
require 'spree/api/testing_support/caching'
|
35
|
-
require 'spree/api/testing_support/helpers'
|
36
|
-
require 'spree/api/testing_support/setup'
|
37
|
-
require 'spree/testing_support/shoulda_matcher_configuration'
|
38
|
-
|
39
|
-
RSpec.configure do |config|
|
40
|
-
config.backtrace_exclusion_patterns = [/gems\/activesupport/, /gems\/actionpack/, /gems\/rspec/]
|
41
|
-
config.color = true
|
42
|
-
config.fail_fast = ENV['FAIL_FAST'] || false
|
43
|
-
config.infer_spec_type_from_file_location!
|
44
|
-
config.raise_errors_for_deprecations!
|
45
|
-
config.use_transactional_fixtures = true
|
46
|
-
|
47
|
-
config.include FactoryGirl::Syntax::Methods
|
48
|
-
config.include Spree::Api::TestingSupport::Helpers, :type => :controller
|
49
|
-
config.extend Spree::Api::TestingSupport::Setup, :type => :controller
|
50
|
-
config.include Spree::TestingSupport::Preferences, :type => :controller
|
51
|
-
|
52
|
-
config.before do
|
53
|
-
Spree::Api::Config[:requires_authentication] = true
|
54
|
-
end
|
55
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
require 'active_support/all'
|
2
|
-
module ControllerHacks
|
3
|
-
extend ActiveSupport::Concern
|
4
|
-
|
5
|
-
included do
|
6
|
-
routes { Spree::Core::Engine.routes }
|
7
|
-
end
|
8
|
-
|
9
|
-
def api_get(action, params={}, session=nil, flash=nil)
|
10
|
-
api_process(action, params, session, flash, "GET")
|
11
|
-
end
|
12
|
-
|
13
|
-
def api_post(action, params={}, session=nil, flash=nil)
|
14
|
-
api_process(action, params, session, flash, "POST")
|
15
|
-
end
|
16
|
-
|
17
|
-
def api_put(action, params={}, session=nil, flash=nil)
|
18
|
-
api_process(action, params, session, flash, "PUT")
|
19
|
-
end
|
20
|
-
|
21
|
-
def api_delete(action, params={}, session=nil, flash=nil)
|
22
|
-
api_process(action, params, session, flash, "DELETE")
|
23
|
-
end
|
24
|
-
|
25
|
-
def api_process(action, params={}, session=nil, flash=nil, method="get")
|
26
|
-
scoping = respond_to?(:resource_scoping) ? resource_scoping : {}
|
27
|
-
process(action, method, params.merge(scoping).reverse_merge!(:format => :json), session, flash)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
RSpec.configure do |config|
|
32
|
-
config.include ControllerHacks, type: :controller
|
33
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
RSpec.configure do |config|
|
2
|
-
config.before(:suite) do
|
3
|
-
DatabaseCleaner.strategy = :transaction
|
4
|
-
DatabaseCleaner.clean_with(:truncation)
|
5
|
-
end
|
6
|
-
|
7
|
-
config.before(:each) do
|
8
|
-
DatabaseCleaner.start
|
9
|
-
end
|
10
|
-
|
11
|
-
config.after(:each) do
|
12
|
-
DatabaseCleaner.clean
|
13
|
-
end
|
14
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
RSpec::Matchers.define :have_attributes do |expected_attributes|
|
6
|
-
match do |actual|
|
7
|
-
# actual is a Hash object representing an object, like this:
|
8
|
-
# { "name" => "Product #1" }
|
9
|
-
actual_attributes = actual.keys.map(&:to_sym)
|
10
|
-
expected_attributes.map(&:to_sym).all? { |attr| actual_attributes.include?(attr) }
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|