Permalink
Browse files

Fixing tests

  • Loading branch information...
1 parent b6b0e6b commit 6c75d679b7a578bfa0e8cf3c896f8853af63f10d @swaroopch committed Dec 30, 2010
@@ -1,6 +1,6 @@
require 'test_helper'
-class BookControllerTest < ActionController::TestCase
+class ContentControllerTest < ActionController::TestCase
test "should get index" do
get :index
assert_response :success
View
@@ -7,7 +7,7 @@ class ActiveSupport::TestCase
#
# Note: You'll currently still have to declare fixtures explicitly in integration tests
# -- they do not yet inherit this setting
- fixtures :all
+ #fixtures :all
# Add more helper methods to be used by all tests here...
end
@@ -4,32 +4,36 @@
class BookpriceTest < ActiveSupport::TestCase
test "price for corporate chanakya" do
- stores = Hash[ Bookprice.instance.prices("9788184951332") ]
- assert_equal(233.75 , stores[:a1books][:price] , "a1books" ) if stores.include?(:a1books)
- assert_equal(220.0 , stores[:bookadda][:price] , "bookadda" ) if stores.include?(:bookadda)
- assert_equal(250.0 , stores[:coralhub][:price] , "coralhub" ) if stores.include?(:coralhub)
- assert_equal(165.0 , stores[:flipkart][:price] , "flipkart" ) if stores.include?(:flipkart)
- assert_equal(165.0 , stores[:indiaplaza][:price] , "indiaplaza" ) if stores.include?(:indiaplaza)
- assert_equal(165.0 , stores[:infibeam][:price] , "infibeam" ) if stores.include?(:infibeam)
- assert_equal(192.0 , stores[:nbcindia][:price] , "nbcindia" ) if stores.include?(:nbcindia)
- assert_equal(1174.0 , stores[:pustak][:price] , "pustak" ) if stores.include?(:pustak)
- assert_equal(Bookprice::NOT_AVAILABLE , stores[:rediff][:price] , "rediff" ) if stores.include?(:rediff)
- assert_equal(193.0 , stores[:tradus][:price] , "tradus" ) if stores.include?(:tradus)
- assert_equal(233.0 , stores[:uread][:price] , "uread" ) if stores.include?(:uread)
+ configatron.temp(:store_timeout => 10) do
+ stores = Hash[ Bookprice.new(:isbn => "9788184951332").perform ]
+ assert_equal(233.75 , stores[:a1books][:price] , "a1books" ) if stores.include?(:a1books)
+ assert_equal(220.0 , stores[:bookadda][:price] , "bookadda" ) if stores.include?(:bookadda)
+ assert_equal(250.0 , stores[:coralhub][:price] , "coralhub" ) if stores.include?(:coralhub)
+ assert_equal(193.0 , stores[:flipkart][:price] , "flipkart" ) if stores.include?(:flipkart)
+ assert_equal(165.0 , stores[:indiaplaza][:price] , "indiaplaza" ) if stores.include?(:indiaplaza)
+ assert_equal(165.0 , stores[:infibeam][:price] , "infibeam" ) if stores.include?(:infibeam)
+ assert_equal(192.0 , stores[:nbcindia][:price] , "nbcindia" ) if stores.include?(:nbcindia)
+ assert_equal(1174.0 , stores[:pustak][:price] , "pustak" ) if stores.include?(:pustak)
+ assert_equal(275.0 , stores[:rediff][:price] , "rediff" ) if stores.include?(:rediff)
+ assert_equal(193.0 , stores[:tradus][:price] , "tradus" ) if stores.include?(:tradus)
+ assert_equal(233.0 , stores[:uread][:price] , "uread" ) if stores.include?(:uread)
+ end
end
test "price for yoga in the workplace" do
- stores = Hash[ Bookprice.instance.prices("9789380032825") ]
- assert_equal(266.0 , stores[:a1books][:price] , "a1books" ) if stores.include?(:a1books)
- assert_equal(236.0 , stores[:bookadda][:price] , "bookadda" ) if stores.include?(:bookadda)
- assert_equal(263.0 , stores[:coralhub][:price] , "coralhub" ) if stores.include?(:coralhub)
- assert_equal(236.0 , stores[:flipkart][:price] , "flipkart" ) if stores.include?(:flipkart)
- assert_equal(204.0 , stores[:indiaplaza][:price] , "indiaplaza" ) if stores.include?(:indiaplaza)
- assert_equal(236.0 , stores[:infibeam][:price] , "infibeam" ) if stores.include?(:infibeam)
- assert_equal(236.0 , stores[:nbcindia][:price] , "nbcindia" ) if stores.include?(:nbcindia)
- assert_equal(1384.0 , stores[:pustak][:price] , "pustak" ) if stores.include?(:pustak)
- assert_equal(Bookprice::NOT_AVAILABLE , stores[:rediff][:price] , "rediff" ) if stores.include?(:rediff)
- assert_equal(Bookprice::NOT_AVAILABLE , stores[:tradus][:price] , "tradus" ) if stores.include?(:tradus)
- assert_equal(233.0 , stores[:uread][:price] , "uread" ) if stores.include?(:uread)
+ configatron.temp(:store_timeout => 10) do
+ stores = Hash[ Bookprice.new(:isbn => "9789380032825").perform ]
+ assert_equal(266.0 , stores[:a1books][:price] , "a1books" ) if stores.include?(:a1books)
+ assert_equal(236.0 , stores[:bookadda][:price] , "bookadda" ) if stores.include?(:bookadda)
+ assert_equal(263.0 , stores[:coralhub][:price] , "coralhub" ) if stores.include?(:coralhub)
+ assert_equal(236.0 , stores[:flipkart][:price] , "flipkart" ) if stores.include?(:flipkart)
+ assert_equal(204.0 , stores[:indiaplaza][:price] , "indiaplaza" ) if stores.include?(:indiaplaza)
+ assert_equal(236.0 , stores[:infibeam][:price] , "infibeam" ) if stores.include?(:infibeam)
+ assert_equal(236.0 , stores[:nbcindia][:price] , "nbcindia" ) if stores.include?(:nbcindia)
+ assert_equal(1384.0 , stores[:pustak][:price] , "pustak" ) if stores.include?(:pustak)
+ assert_equal(Bookprice::NOT_AVAILABLE , stores[:rediff][:price] , "rediff" ) if stores.include?(:rediff)
+ assert_equal(Bookprice::NOT_AVAILABLE , stores[:tradus][:price] , "tradus" ) if stores.include?(:tradus)
+ assert_equal(233.0 , stores[:uread][:price] , "uread" ) if stores.include?(:uread)
+ end
end
end

0 comments on commit 6c75d67

Please sign in to comment.