spec/pagseguro/rake_spec.rb in pagseguro-0.1.0 vs spec/pagseguro/rake_spec.rb in pagseguro-0.1.1
- old
+ new
@@ -16,15 +16,15 @@
@destiny = Rails.root.join("tmp/pagseguro-test.yml")
FileUtils.cp @origin, @destiny
# Stub Digest::MD5#hexdigest to always return THEHASH
- Digest::MD5.stub!(:hexdigest).and_return("THEHASH")
+ Digest::MD5.stub :hexdigest => "THEHASH"
# Stub the URI#parse to return a mock
@uri = mock("URI").as_null_object
- URI.stub!(:parse).and_return(@uri)
+ URI.stub :parse => @uri
# Load the pagseguro-test.yml file to
# set some variables in order to compare it
@orders = YAML.load_file(@origin)
@order = @orders["ABC"]
@@ -53,11 +53,11 @@
it "should set order id" do
params["Referencia"].should == "ABC"
end
it "should set number of items" do
- params["NumItens"].should == 3
+ params["NumItens"].should == 4
end
it "should set note" do
ENV["NOTE"] = "Deliver ASAP"
PagSeguro::Rake.run
@@ -70,11 +70,11 @@
params["CliNome"].should == "Rafael Mendonça França"
end
it "should set transaction date" do
now = Time.now
- Time.stub!(:now).and_return(now)
+ Time.stub :now => now
PagSeguro::Rake.run
params["DataTransacao"].should == now.strftime("%d/%m/%Y %H:%M:%S")
end
@@ -101,9 +101,16 @@
params["ProdDescricao_3"].should == "Ruby T-Shirt"
params["ProdValor_3"].should == "19,89"
params["ProdQuantidade_3"].should == "2"
params["ProdExtras_3"].should == "0,00"
params["ProdFrete_3"].should == "2,50"
+
+ params["ProdID_4"].should == "4"
+ params["ProdDescricao_4"].should == "Ruby Mug"
+ params["ProdValor_4"].should == "15,99"
+ params["ProdQuantidade_4"].should == "1"
+ params["ProdExtras_4"].should == "0,00"
+ params["ProdFrete_4"].should == "0,00"
end
it "should set client info" do
params["CliNome"].should_not be_blank
params["CliEmail"].should_not be_blank