Skip to content

Commit

Permalink
#8 use AR5 in base class collection parser, add ar5 gemfile for tests…
Browse files Browse the repository at this point in the history
…, cleanup tests
  • Loading branch information
schorsch committed Aug 30, 2018
1 parent d459158 commit a7e1fc3
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 12 deletions.
4 changes: 4 additions & 0 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,8 @@ Before running the specs, add your SalesKing credentials to /spec/settings.yml
BUNDLE_GEMFILE=ci/Gemfile_ar3 bundle install
BUNDLE_GEMFILE=ci/Gemfile_ar3 bundle exec rake spec

#test with ActiveResource 5
BUNDLE_GEMFILE=ci/Gemfile_ar5 bundle install
BUNDLE_GEMFILE=ci/Gemfile_ar5 bundle exec rake spec

Copyright (c) 2011-2016 Georg Leciejewski, released under the MIT license
11 changes: 11 additions & 0 deletions ci/Gemfile_ar5
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
source 'https://rubygems.org'
gem "rake"
gem "rdoc"
gem "activesupport", "5.2"
gem "activeresource", "5.0"
gem "sk_api_schema"
gem "curb"
group :test do
gem "rspec"
gem "simplecov"
end
68 changes: 68 additions & 0 deletions ci/Gemfile_ar5.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
GEM
remote: https://rubygems.org/
specs:
activemodel (5.2.0)
activesupport (= 5.2.0)
activemodel-serializers-xml (1.0.2)
activemodel (> 5.x)
activesupport (> 5.x)
builder (~> 3.1)
activeresource (5.0.0)
activemodel (>= 5.0, < 6)
activemodel-serializers-xml (~> 1.0)
activesupport (>= 5.0, < 6)
activesupport (5.2.0)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
builder (3.2.3)
concurrent-ruby (1.0.5)
curb (0.9.6)
diff-lcs (1.3)
docile (1.3.1)
i18n (1.1.0)
concurrent-ruby (~> 1.0)
json (2.1.0)
minitest (5.11.3)
rake (12.3.1)
rdoc (6.0.4)
rspec (3.8.0)
rspec-core (~> 3.8.0)
rspec-expectations (~> 3.8.0)
rspec-mocks (~> 3.8.0)
rspec-core (3.8.0)
rspec-support (~> 3.8.0)
rspec-expectations (3.8.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-mocks (3.8.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-support (3.8.0)
simplecov (0.16.1)
docile (~> 1.1)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
sk_api_schema (0.11.0)
activesupport
thread_safe (0.3.6)
tzinfo (1.2.5)
thread_safe (~> 0.1)

PLATFORMS
ruby

DEPENDENCIES
activeresource (= 5.0)
activesupport (= 5.2)
curb
rake
rdoc
rspec
simplecov
sk_api_schema

BUNDLED WITH
1.16.0
2 changes: 1 addition & 1 deletion lib/sk_sdk/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def self.site_api_url(site)

# Unfortunately only using AR v4+ we can create additional accessors
# to get info on collection info and links
if ActiveResource::VERSION::MAJOR == 4
if [4,5].include?(ActiveResource::VERSION::MAJOR)

This comment has been minimized.

Copy link
@siebertm

siebertm Aug 30, 2018

Should this maybe be changed to ActiveResource::VERSION::MAJOR >= 4? Anticipating Rails 6, you know?

This comment has been minimized.

Copy link
@schorsch

schorsch Aug 30, 2018

Author Member

good idea, will simplify the statement.

class SkCollection < ActiveResource::Collection
attr_accessor :current_page, :per_page, :total_entries, :total_pages

Expand Down
4 changes: 0 additions & 4 deletions spec/sk_sdk/resources/payment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,4 @@

end

def destroy_payment

end

end
7 changes: 0 additions & 7 deletions spec/sk_sdk/resources/product_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,6 @@
product.name.should == @product.name
end

it "should edit a product" do
@product.name = 'A new product name'
@product.lock_version.should == 0
@product.save
@product.lock_version.should == 1 # because save returns the data
end

it "should fail edit a product" do
@product.name = ''
@product.save.should == false
Expand Down

0 comments on commit a7e1fc3

Please sign in to comment.