dribbble-bucket-api 0.0.2 → 0.0.3

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.
@@ -13,7 +13,7 @@ module DribbbleBucketApi
13
13
  def buckets
14
14
  @buckets ||= document.css(".bucket-list > li").map do |bucket|
15
15
  # parse bucket data from HTML
16
- id = bucket["class"].gsub(/^bucket\-(\d+)$/, "\1").to_i
16
+ id = bucket["class"] =~ /^bucket\-(\d+)$/ && $1.to_i
17
17
  name = bucket.css(".bucket-title a").first.text
18
18
  # pass data into bucket object
19
19
  Bucket.new(id: id, name: name, username: username)
@@ -1,3 +1,3 @@
1
1
  module DribbbleBucketApi
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -64,6 +64,11 @@ describe DribbbleBucketApi::BucketIndexParser do
64
64
  expect(bucket).to be_kind_of DribbbleBucketApi::Bucket
65
65
  end
66
66
  end
67
+
68
+ it "should parse the ids correctly" do
69
+ ids = subject.buckets.map(&:id)
70
+ expect(ids).to eq [12345, 67890, 98760, 54321, 12093]
71
+ end
67
72
  end
68
73
 
69
74
  describe "#current_page" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dribbble-bucket-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: