backpack_tf 0.8.4 → 1.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -3
  3. data/.rspec +2 -0
  4. data/.travis.yml +3 -0
  5. data/Gemfile +5 -3
  6. data/Gemfile.lock +49 -0
  7. data/README.md +144 -0
  8. data/Rakefile +7 -0
  9. data/backpack_tf.gemspec +2 -2
  10. data/lib/backpack_tf/assets/{attribute_controlled_attached_particles.json → particle_effects.json} +0 -0
  11. data/lib/backpack_tf/client.rb +72 -95
  12. data/lib/backpack_tf/currency/interface.rb +9 -0
  13. data/lib/backpack_tf/currency/response.rb +24 -0
  14. data/lib/backpack_tf/currency.rb +24 -47
  15. data/lib/backpack_tf/helpers.rb +29 -0
  16. data/lib/backpack_tf/interface.rb +29 -0
  17. data/lib/backpack_tf/market_price/interface.rb +9 -0
  18. data/lib/backpack_tf/market_price/response.rb +15 -0
  19. data/lib/backpack_tf/market_price.rb +25 -0
  20. data/lib/backpack_tf/price/interface.rb +19 -0
  21. data/lib/backpack_tf/price/item.rb +85 -0
  22. data/lib/backpack_tf/price/item_price.rb +113 -0
  23. data/lib/backpack_tf/price/particle_effect.rb +27 -0
  24. data/lib/backpack_tf/price/response.rb +38 -0
  25. data/lib/backpack_tf/price.rb +9 -81
  26. data/lib/backpack_tf/price_history/interface.rb +22 -0
  27. data/lib/backpack_tf/price_history/response.rb +15 -0
  28. data/lib/backpack_tf/price_history.rb +25 -0
  29. data/lib/backpack_tf/response.rb +9 -56
  30. data/lib/backpack_tf/special_item/interface.rb +9 -0
  31. data/lib/backpack_tf/special_item/response.rb +16 -0
  32. data/lib/backpack_tf/special_item.rb +11 -21
  33. data/lib/backpack_tf/user/interface.rb +18 -0
  34. data/lib/backpack_tf/user/response.rb +16 -0
  35. data/lib/backpack_tf/user.rb +10 -19
  36. data/lib/backpack_tf/user_listing/interface.rb +18 -0
  37. data/lib/backpack_tf/user_listing/response.rb +15 -0
  38. data/lib/backpack_tf/user_listing.rb +31 -43
  39. data/lib/backpack_tf/version.rb +1 -1
  40. data/lib/backpack_tf.rb +8 -8
  41. data/spec/backpack_tf/client_spec.rb +151 -101
  42. data/spec/backpack_tf/currency/interface_spec.rb +8 -0
  43. data/spec/backpack_tf/currency/response_spec.rb +41 -0
  44. data/spec/backpack_tf/currency_spec.rb +34 -118
  45. data/spec/backpack_tf/helpers_spec.rb +85 -0
  46. data/spec/backpack_tf/interface_spec.rb +56 -0
  47. data/spec/backpack_tf/market_price/interface_spec.rb +8 -0
  48. data/spec/backpack_tf/market_price/response_spec.rb +22 -0
  49. data/spec/backpack_tf/market_price_spec.rb +22 -0
  50. data/spec/backpack_tf/price/interface_spec.rb +27 -0
  51. data/spec/backpack_tf/price/item_price_spec.rb +101 -0
  52. data/spec/backpack_tf/price/item_spec.rb +291 -0
  53. data/spec/backpack_tf/price/particle_effect_spec.rb +23 -0
  54. data/spec/backpack_tf/price/response_spec.rb +87 -0
  55. data/spec/backpack_tf/price_history/interface_spec.rb +38 -0
  56. data/spec/backpack_tf/price_history/response_spec.rb +22 -0
  57. data/spec/backpack_tf/price_history_spec.rb +24 -0
  58. data/spec/backpack_tf/response_spec.rb +22 -108
  59. data/spec/backpack_tf/special_item/interface_spec.rb +8 -0
  60. data/spec/backpack_tf/special_item/response_spec.rb +26 -0
  61. data/spec/backpack_tf/special_item_spec.rb +23 -100
  62. data/spec/backpack_tf/user/interface_spec.rb +20 -0
  63. data/spec/backpack_tf/user/response_spec.rb +27 -0
  64. data/spec/backpack_tf/user_listing/interface_spec.rb +20 -0
  65. data/spec/backpack_tf/user_listing/response_spec.rb +21 -0
  66. data/spec/backpack_tf/user_listing_spec.rb +53 -81
  67. data/spec/backpack_tf/user_spec.rb +16 -83
  68. data/spec/fixtures/item_price_typical.json +6 -0
  69. data/spec/fixtures/item_price_unusual.json +7 -0
  70. data/spec/fixtures/item_typical.json +1 -1
  71. data/spec/fixtures/item_unusual.json +311 -1
  72. data/spec/fixtures/item_with_dual_craftability_tradability.json +59 -0
  73. data/spec/fixtures/market_prices.json +1 -0
  74. data/spec/fixtures/price_history.json +1 -0
  75. data/spec/fixtures/prices.json +80 -1
  76. data/spec/fixtures/user_listing.json +1 -1
  77. data/spec/fixtures/user_listing_individual.json +51 -0
  78. data/spec/spec_helper.rb +12 -52
  79. metadata +61 -16
  80. data/TODO.md +0 -15
  81. data/lib/backpack_tf/item.rb +0 -84
  82. data/lib/backpack_tf/item_price.rb +0 -172
  83. data/readme.md +0 -96
  84. data/spec/backpack_tf/inherited_class_methods_spec.rb +0 -100
  85. data/spec/backpack_tf/item_price_spec.rb +0 -119
  86. data/spec/backpack_tf/item_spec.rb +0 -126
  87. data/spec/backpack_tf/price_spec.rb +0 -184
  88. data/spec/fixtures/item_without_defindex.json +0 -1
@@ -1,100 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module BackpackTF
4
-
5
- shared_examples 'a class inheriting methods from Response' do |file|
6
- let(:bp) { Client.new }
7
- let(:json_obj) {
8
- fixture = file_fixture(file)
9
- fixture = JSON.parse(fixture)['response']
10
- Response.hash_keys_to_sym(fixture)
11
- }
12
-
13
- before :all do
14
- mock_alias
15
- end
16
-
17
- it 'should respond to these inherited methods' do
18
- expect(described_class).to respond_to :responses, :interface, :to_sym, :hash_keys_to_sym
19
- end
20
-
21
- it 'should respond to this aliased method (for testing only)' do
22
- expect(described_class).to respond_to :data_storage
23
- end
24
-
25
- describe '::to_sym' do
26
- it 'returns a Symbol of the name of the name of the class' do
27
- expect(described_class.to_sym).to eq described_class.to_s.to_sym
28
- end
29
- end
30
-
31
- describe '::responses' do
32
- before :all do
33
- expect(Response.responses).to be_empty
34
- end
35
-
36
- after :all do
37
- Response.responses(:reset => :confirm)
38
- expect(Response.responses).to be_empty
39
- expect(described_class.response).to be_nil
40
- end
41
-
42
- it "Response class can access response for #{described_class} by calling the key #{described_class}" do
43
- stub_http_response_with(file)
44
- fetched_data = bp.fetch(make_fetch_sym)
45
- bp.update(described_class, fetched_data)
46
- expect(Response.responses[described_class.to_sym]).to eq json_obj
47
- end
48
- end
49
-
50
- describe '::response' do
51
- before :all do
52
- expect(described_class.response).to be_nil
53
- end
54
-
55
- before :each do
56
- stub_http_response_with(file)
57
- fetched_data = bp.fetch(make_fetch_sym)
58
- bp.update(described_class, fetched_data)
59
- end
60
-
61
- after :all do
62
- Response.responses(:reset => :confirm)
63
- expect(Response.responses).to be_empty
64
- expect(described_class.response).to be_nil
65
- expect(described_class.data_storage).to be_nil
66
- end
67
-
68
- it 'can access response information' do
69
- expect(described_class.response).to eq json_obj
70
- end
71
-
72
- it "returns same info as the Response class calling Price key" do
73
- result = Response.responses[described_class.to_sym]
74
- expect(described_class.response).to eq result
75
- end
76
- end
77
-
78
- end
79
-
80
- describe Price do
81
- it_behaves_like('a class inheriting methods from Response', 'prices.json')
82
- end
83
-
84
- describe Currency do
85
- it_behaves_like('a class inheriting methods from Response', 'currencies.json')
86
- end
87
-
88
- describe SpecialItem do
89
- it_behaves_like('a class inheriting methods from Response', 'special_items.json')
90
- end
91
-
92
- describe User do
93
- it_behaves_like('a class inheriting methods from Response', 'users.json')
94
- end
95
-
96
- describe UserListing do
97
- it_behaves_like('a class inheriting methods from Response', 'user_listing.json')
98
- end
99
-
100
- end
@@ -1,119 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module BackpackTF
4
- describe ItemPrice do
5
-
6
- describe '::quality_name_to_index' do
7
- it 'returns Quality Index of the name of Quality' do
8
- expect(described_class.quality_name_to_index('Strange')).to eq 11
9
- end
10
- it 'returns nil when you ask for index of `nil`' do
11
- expect(described_class.quality_name_to_index(nil)).to be_nil
12
- end
13
- end
14
-
15
- describe '::hash_particle_effects' do
16
- it 'creates a key value pair for each id & name' do
17
- expect(described_class.hash_particle_effects[17]).to eq 'Sunbeams'
18
- expect(described_class.hash_particle_effects[5]).to eq 'Holy Glow'
19
- end
20
- it 'is nil if it cannot find that key' do
21
- expect(described_class.hash_particle_effects[nil]).to be_nil
22
- end
23
-
24
- context '@@particle_effects' do
25
- it 'same thing can be accessed through class variable' do
26
- expect(described_class.particle_effects[17]).to eq 'Sunbeams'
27
- expect(described_class.particle_effects[5]).to eq 'Holy Glow'
28
- end
29
- it 'is nil if it cannot find that key' do
30
- expect(described_class.particle_effects[nil]).to be_nil
31
- end
32
- end
33
- end
34
-
35
- describe '#initialize' do
36
- base_json = JSON.parse(file_fixture('item_typical.json'))['Kritzkrieg']
37
- ok_json = base_json['prices']['6']['Tradable']['Craftable'][0]
38
- wrong_level = base_json['prices']['6']['Tradable']
39
-
40
- context 'validating first parameter' do
41
-
42
- it 'will raise ArgumentError if there is not enough information' do
43
- expect{described_class.new('Unique_Tradable', ok_json)}.to raise_error ArgumentError
44
- end
45
- it 'will raise NameError if any one of the info bits is incorrect' do
46
- expect{described_class.new('xx_Tradable_Craftable', ok_json)}.to raise_error NameError
47
- end
48
- it 'will raise a NameError if name has correct info but is out of order' do
49
- expect{described_class.new('Craftable_Tradable_Strange', ok_json)}.to raise_error NameError
50
- end
51
- end
52
- context 'validating 2nd parameter' do
53
- it 'will raise a KeyError if JSON does not have required keys' do
54
- expect{described_class.new('Unique_Tradable_Craftable', wrong_level)}.to raise_error KeyError
55
- end
56
- end
57
- end
58
-
59
- shared_examples 'an ItemPrice object' do
60
- it 'should respond to these methods' do
61
- expect(subject).to respond_to :quality, :tradability, :craftability, :priceindex, :currency, :value, :value_high, :value_raw, :value_high_raw, :last_update, :difference
62
- end
63
- end
64
-
65
- describe 'A price for a typical item' do
66
- item_price_attr = JSON.parse(file_fixture('item_typical.json'))['Kritzkrieg']['prices']['6']['Tradable']['Craftable'][0]
67
-
68
- subject {
69
- described_class.new('Unique_Tradable_Craftable', item_price_attr)
70
- }
71
-
72
- it_behaves_like('an ItemPrice object')
73
-
74
- context 'item-specific tests' do
75
- it 'should have these values' do
76
- expect(subject.quality).to eq :Unique
77
- expect(subject.tradability).to eq :Tradable
78
- expect(subject.craftability).to eq :Craftable
79
- expect(subject.currency).to eq :metal
80
- expect(subject.value).to eq 0.05
81
- expect(subject.value_high).to be_nil
82
- expect(subject.value_raw).to be_nil
83
- expect(subject.value_high_raw).to be_nil
84
- expect(subject.last_update).to eq 1336410088
85
- expect(subject.difference).to eq 0
86
- expect(subject.priceindex).to be_nil
87
- expect(subject.effect).to be_nil
88
- end
89
- end
90
- end
91
-
92
- describe "A price for an item with 'Unusual' quality" do
93
- item_price_attr = JSON.parse(file_fixture('item_unusual.json'))['Barnstormer']['prices']['5']['Tradable']['Craftable']['6']
94
-
95
- subject {
96
- described_class.new('Unusual_Tradable_Craftable', item_price_attr, 6)
97
- }
98
-
99
- it_behaves_like('an ItemPrice object')
100
-
101
- context 'item-specific tests' do
102
- it 'should have these values' do
103
- expect(subject.quality).to eq :Unusual
104
- expect(subject.tradability).to eq :Tradable
105
- expect(subject.craftability).to eq :Craftable
106
- expect(subject.currency).to eq :keys
107
- expect(subject.value).to eq 18
108
- expect(subject.value_high).to eq 22
109
- expect(subject.value_raw).to be_nil
110
- expect(subject.value_high_raw).to be_nil
111
- expect(subject.last_update).to eq 1418795322
112
- expect(subject.difference).to eq 280
113
- expect(subject.priceindex).to eq 6
114
- expect(subject.effect).to eq 'Green Confetti'
115
- end
116
- end
117
- end
118
- end
119
- end
@@ -1,126 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module BackpackTF
4
- describe Item do
5
- shared_examples 'a common item' do |passed_item_attr|
6
- it 'should respond to these methods' do
7
- expect(subject).to respond_to :item_name, :defindex, :prices, :generate_prices_hash
8
- end
9
-
10
- describe '#generate_prices_hash' do
11
- let(:prices_hash) { subject.generate_prices_hash(passed_item_attr) }
12
-
13
- it 'generates a Hash' do
14
- expect(prices_hash).to be_instance_of Hash
15
- end
16
- it 'each key is a String' do
17
- expect(prices_hash.keys).to all be_a String
18
- end
19
- it 'value of each key is an ItemPrice object' do
20
- expect(prices_hash.values).to all be_an ItemPrice
21
- end
22
- end
23
-
24
- describe 'the @prices instance variable' do
25
- it 'is a Hash' do
26
- expect(subject.prices).to be_a Hash
27
- end
28
- it 'each value is an ItemPrice object' do
29
- expect(subject.prices.values).to all be_an ItemPrice
30
- end
31
- end
32
- end
33
-
34
- describe 'A typical item' do
35
- item_attr = JSON.parse(file_fixture('item_typical.json'))['Kritzkrieg']
36
- item = described_class.new('Kritzkrieg', item_attr)
37
- subject { item }
38
- it_behaves_like('a common item', item_attr)
39
-
40
- context 'item-specific tests' do
41
- it 'should have these values' do
42
- expect(subject.item_name).to eq 'Kritzkrieg'
43
- expect(subject.defindex).to eq 35
44
- end
45
- xit '@prices should have these keys' do
46
- ans = ['Strange_Tradable_Craftable',
47
- "Collector's_Tradable_Craftable",
48
- 'Vintage_Tradable_Craftable',
49
- 'Unique_Tradable_Craftable',
50
- 'Unique_Tradable_Non-Craftable']
51
- expect(subject.prices.keys).to match_array ans
52
- end
53
- end
54
- end
55
-
56
- describe "An item with the quality of 'Unusual'" do
57
- item_attr = JSON.parse(file_fixture('item_unusual.json'))['Barnstormer']
58
- item = described_class.new('Barnstormer', item_attr)
59
- subject { item }
60
- it_behaves_like('a common item', item_attr)
61
-
62
- context 'item-specific tests' do
63
- it 'should have these values' do
64
- expect(item.item_name).to eq 'Barnstormer'
65
- expect(item.defindex).to eq 988
66
- end
67
- it '@prices should have these keys' do
68
- priceindex_vals = ["Aces High", "Anti-Freeze", "Blizzardy Storm", "Bubbling", "Burning Flames", "Circling Heart", "Circling TF Logo", "Cloud 9", "Dead Presidents", "Death at Dusk", "Disco Beat Down", "Electrostatic", "Green Black Hole", "Green Confetti", "Green Energy", "Haunted Ghosts", "Kill-a-Watt", "Memory Leak", "Miami Nights", "Morning Glory", "Nuts n' Bolts", "Orbiting Fire", "Orbiting Planets", "Overclocked", "Phosphorous", "Power Surge", "Purple Confetti", "Purple Energy", "Roboactive", "Scorching Flames", "Smoking", "Steaming", "Stormy Storm", "Sulphurous", "Terror-Watt", "Time Warp", "Unique_Tradable_Craftable"]
69
- expect(subject.prices.keys).to match_array priceindex_vals
70
- end
71
- end
72
- end
73
-
74
- describe 'An item with many priceindex values (Crate or Unusual)' do
75
- item_attr = JSON.parse(file_fixture('item_crate.json'))['Mann Co. Supply Munition']
76
- item = described_class.new('Mann Co. Supply Munition', item_attr)
77
- subject { item }
78
- it_behaves_like('a common item', item_attr)
79
-
80
- context 'item-specific tests' do
81
- it 'should have these values' do
82
- expect(subject.item_name).to eq 'Mann Co. Supply Munition'
83
- expect(subject.defindex).to match_array [5734, 5735, 5742, 5752, 5781, 5802, 5803]
84
- end
85
- it 'prices array should have these keys' do
86
- ans = ['Unique_Tradable_Craftable_#82',
87
- 'Unique_Tradable_Craftable_#83',
88
- 'Unique_Tradable_Craftable_#84',
89
- 'Unique_Tradable_Craftable_#85',
90
- 'Unique_Tradable_Craftable_#90',
91
- 'Unique_Tradable_Craftable_#91',
92
- 'Unique_Tradable_Craftable_#92']
93
- expect(subject.prices.keys).to match_array ans
94
- end
95
- end
96
- end
97
-
98
- describe 'An item with an unconventional structure' do
99
- item_attr = JSON.parse(file_fixture('item_with_unconventional_structure.json'))['Aqua Summer 2013 Cooler']
100
- item = described_class.new('Aqua Summer 2013 Cooler', item_attr)
101
- subject { item }
102
- it_behaves_like('a common item', item_attr)
103
-
104
- context 'item-specific tests' do
105
- it 'should have these values' do
106
- expect(item.item_name).to eq 'Aqua Summer 2013 Cooler'
107
- expect(item.defindex).to eq 5650
108
- end
109
- end
110
- end
111
-
112
- describe "An item that has a negative 'defindex' or no 'defindex' at all" do
113
- item_attr = JSON.parse(file_fixture('item_without_defindex.json'))['Strange Part: Fires Survived']
114
- item = described_class.new('Strange Part: Fires Survived', item_attr)
115
- subject { item }
116
- it_behaves_like('a common item', item_attr)
117
-
118
- context 'item-specific tests' do
119
- it 'should have these values' do
120
- expect(item.item_name).to eq 'Strange Part: Fires Survived'
121
- expect(item.defindex).to eq nil
122
- end
123
- end
124
- end
125
- end
126
- end
@@ -1,184 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module BackpackTF
4
- describe Price do
5
-
6
- let(:bp) { Client.new }
7
-
8
- let(:json_obj) {
9
- fixture = file_fixture('prices.json')
10
- fixture = JSON.parse(fixture)['response']
11
- Response.hash_keys_to_sym(fixture)
12
- }
13
-
14
- it 'has these default attributes' do
15
- expect(described_class.interface).to eq :IGetPrices
16
- end
17
-
18
- it 'raises an error when trying to instantiate this class' do
19
- expect{described_class.new}.to raise_error RuntimeError
20
- end
21
-
22
- describe '::response' do
23
- before :all do
24
- expect(described_class.response).to be_nil
25
- end
26
-
27
- before :each do
28
- stub_http_response_with('prices.json')
29
- fetched_prices = bp.fetch(:prices)
30
- bp.update(described_class, fetched_prices)
31
- end
32
-
33
- after :all do
34
- Response.responses(:reset => :confirm)
35
- expect(Response.responses).to be_empty
36
- expect(described_class.response).to be_nil
37
- expect(described_class.items).to be_nil
38
- end
39
-
40
- it 'the keys of the response attribute should have these values' do
41
- response = described_class.response
42
- expect(response[:success]).to eq 1
43
- expect(response[:message]).to eq nil
44
- expect(response[:current_time]).to eq 1430785805
45
- expect(response[:raw_usd_value]).to eq 0.115
46
- expect(response[:usd_currency]).to eq 'metal'
47
- expect(response[:usd_currency_index]).to eq 5002
48
- end
49
- end
50
-
51
- describe '::generate_items' do
52
- before :each do
53
- stub_http_response_with('prices.json')
54
- fetched_prices = bp.fetch(:prices)
55
- bp.update(described_class, fetched_prices)
56
- end
57
-
58
- after :all do
59
- Response.responses(:reset => :confirm)
60
- expect(Response.responses).to be_empty
61
- described_class.class_eval { @items = nil }
62
- end
63
-
64
- it 'each key of hash is a String' do
65
- expect(described_class.generate_items.keys).to all be_a String
66
- end
67
- it 'each value of hash is an Item object' do
68
- expect(described_class.generate_items.values).to all be_an Item
69
- end
70
- it 'if an item does not have a valid `defindex`, then it is ignored' do
71
- expect(described_class.generate_items['Random Craft Hat']).to be_nil
72
- expect(described_class.generate_items[':weed:']).to be_nil
73
- end
74
- end
75
-
76
- describe '::items' do
77
- before :each do
78
- stub_http_response_with('prices.json')
79
- fetched_prices = bp.fetch(:prices)
80
- bp.update(described_class, fetched_prices)
81
- end
82
-
83
- after :all do
84
- Response.responses(:reset => :confirm)
85
- expect(Response.responses).to be_empty
86
- described_class.class_eval { @items = nil }
87
- end
88
-
89
- it 'returns the fixture and sets to @@items variable' do
90
- expect(described_class.items).not_to be_nil
91
- end
92
-
93
- context '@@items attribute' do
94
- it 'should be a Hash object' do
95
- expect(described_class.items).to be_instance_of Hash
96
- end
97
- xit 'should have this many keys' do
98
- expect(described_class.items.keys.length).to be 1661
99
- end
100
- it 'each key should be a String' do
101
- expect(described_class.items.keys).to all be_a String
102
- end
103
- it 'each value should be an Item' do
104
- expect(described_class.items.values).to all be_an Item
105
- end
106
- end
107
-
108
- context 'using keys to generate Item objects' do
109
- let(:random_key) { described_class.items.keys.sample }
110
- let(:item) { described_class.items[random_key] }
111
-
112
- it 'generates an Item object' do
113
- expect(item).to be_instance_of Item
114
- end
115
- it 'the Item object responds to these methods' do
116
- expect(item).to respond_to :item_name, :defindex, :prices
117
- end
118
- it 'uses the key to assign a value to the @item_name property of the Item' do
119
- expect(random_key).to eq item.item_name
120
- end
121
- it 'passes itself to be stored in the @prices attribute of the Item object' do
122
- expect(described_class.items[random_key].prices).to eq item.prices
123
- end
124
- end
125
- end
126
-
127
- describe '::find_item_by_name' do
128
- let(:item) { described_class.items['Kritzkrieg'] }
129
-
130
- before :each do
131
- stub_http_response_with('prices.json')
132
- fetched_prices = bp.fetch(:prices)
133
- bp.update(described_class, fetched_prices)
134
- end
135
-
136
- after :each do
137
- Response.responses(:reset => :confirm)
138
- expect(Response.responses).to be_empty
139
- described_class.class_eval { @items = nil }
140
- end
141
-
142
- it 'returns Item object for the item matching the name' do
143
- expect(described_class.find_item_by_name('Kritzkrieg')).to eq item
144
- end
145
- it 'can return picked attributes' do
146
- expect(described_class.find_item_by_name('Kritzkrieg', :defindex)).to eq 35
147
- end
148
- it 'raises a KeyError if you ask for attribute it does not have' do
149
- expect{described_class.find_item_by_name('Kritzkrieg', :foo)}.to raise_error KeyError
150
- end
151
- end
152
-
153
- describe '::random_item' do
154
- before :each do
155
- stub_http_response_with('prices.json')
156
- fetched_prices = bp.fetch(:prices)
157
- bp.update(described_class, fetched_prices)
158
- end
159
-
160
- after :each do
161
- Response.responses(:reset => :confirm)
162
- expect(Response.responses).to be_empty
163
- described_class.class_eval { @items = nil }
164
- end
165
-
166
- it 'returns a name of an Item object' do
167
- item = described_class.random_item
168
- expect(described_class.items.keys.include? item).to be_truthy
169
- end
170
-
171
- context 'asking for prices property' do
172
- let(:item_prices) { described_class.random_item :price }
173
-
174
- it 'returns a Hash object where keys are String objects' do
175
- expect(item_prices.keys).to all be_a String
176
- end
177
- it 'returns a Hash object where values are ItemPrice objects' do
178
- expect(item_prices.values).to all be_an ItemPrice
179
- end
180
- end
181
- end
182
-
183
- end
184
- end
@@ -1 +0,0 @@
1
- {"Strange Part: Fires Survived":{"defindex":[],"prices":{"6":{"Tradable":{"Craftable":[{"currency":"metal","value":0.66,"last_update":1393622359,"difference":-0.17}]}}}}}