daily pastebin goal
75%
SHARE
TWEET

Untitled

a guest May 16th, 2018 101 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. require File.dirname(__FILE__) + '/../spec_helper'
  2.  
  3. describe ExchangeProcessor, "processing trade item" do
  4.   set_fixture_class(:exchange_originals => Exchange::Original, :exchange_items => Exchange::TradeItem)
  5.   fixtures :exchange_originals, :exchanges, :exchange_trade_items, :original_cards
  6.   before :each do
  7.     @exchange = exchanges(:three_virkans_for_travis)
  8.     @user = users(:mourat)
  9.     @processor = ExchangeProcessor.new(@user, @exchange)
  10.   end
  11.  
  12.   it "takes off cards for this exchange" do
  13.      lambda {@processor.process_trade_items}.should change(@user.cards, :count).by(-3)
  14.   end
  15. end
  16.  
  17. describe ExchangeProcessor, "processing original card" do
  18.   set_fixture_class(:exchange_originals => Exchange::Original, :exchange_items => Exchange::TradeItem)
  19.   fixtures :exchange_originals, :exchanges, :exchange_trade_items, :original_cards
  20.   before :each do
  21.     @exchange = exchanges(:three_virkans_for_travis)
  22.     @user = users(:mourat)
  23.     @processor = ExchangeProcessor.new(@user, @exchange)
  24.   end
  25.  
  26.   it "gives rare/uniq/legend card designated by exchange original to the user" do
  27.     lambda {@processor.process_original_card}.should change(@user.cards, :count).by(1)
  28.   end
  29. end
  30.  
  31. describe ExchangeProcessor, "decreasing operations limit" do
  32.   set_fixture_class(:exchange_originals => Exchange::Original, :exchange_items => Exchange::TradeItem)
  33.   fixtures :exchange_originals, :exchanges, :exchange_trade_items, :original_cards
  34.   before :each do
  35.     @exchange = exchanges(:three_virkans_for_travis)
  36.     @user = users(:mourat)
  37.     @processor = ExchangeProcessor.new(@user, @exchange)
  38.   end
  39.  
  40.   it "decrease limit of operations by one for limited exchange" do
  41.     lambda {@processor.decrease_limit}.should change(@exchange, :count).by(-1)
  42.   end
  43. end
  44.  
  45. describe ExchangeProcessor, "process" do
  46.   set_fixture_class(:exchange_originals => Exchange::Original, :exchange_items => Exchange::TradeItem)
  47.   fixtures :exchange_originals, :exchanges, :exchange_trade_items, :original_cards
  48.   before :each do
  49.     @exchange = exchanges(:three_virkans_for_travis)
  50.     @user = users(:mourat)
  51.     @processor = ExchangeProcessor.new(@user, @exchange)
  52.   end
  53.  
  54.   it "takes off cards for ALL trade items" do
  55.      lambda {@processor.process}.should change(@user.cards, :count).by(-3)
  56.   end
  57.  
  58.   it "gives rare/uniq/legend card designated by exchange original to the user" do
  59.     lambda {@processor.process}.should change(@user.cards, :count).by(1)
  60.   end
  61.  
  62.   it "decrease limit of operations by one" do
  63.     lambda {@processor.process}.should change(@exchange, :count).by(-1)
  64.   end
  65.  
  66. end
RAW Paste Data
Top