-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
254 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Copyright (c) 2009 Vitaly Kushner | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
require 'rubygems' | ||
require 'rake' | ||
|
||
begin | ||
require 'jeweler' | ||
Jeweler::Tasks.new do |gem| | ||
gem.name = "active_merchant_tranzila" | ||
gem.summary = %Q{Tranzila gateway support for ActiveMerchant} | ||
gem.description = %Q{Tranzila gateway support for ActiveMerchant} | ||
gem.email = "[email protected]" | ||
gem.homepage = "http://github.com/astrails/active_merchant_tranzila" | ||
gem.authors = ["Astrails Ltd."] | ||
end | ||
Jeweler::GemcutterTasks.new | ||
rescue LoadError | ||
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler" | ||
end | ||
|
||
require 'rake/testtask' | ||
Rake::TestTask.new(:test) do |test| | ||
test.libs << 'lib' << 'test' | ||
test.pattern = 'test/**/*_test.rb' | ||
test.verbose = true | ||
end | ||
|
||
begin | ||
require 'rcov/rcovtask' | ||
Rcov::RcovTask.new do |test| | ||
test.libs << 'test' | ||
test.pattern = 'test/**/*_test.rb' | ||
test.verbose = true | ||
end | ||
rescue LoadError | ||
task :rcov do | ||
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov" | ||
end | ||
end | ||
|
||
task :test => :check_dependencies | ||
|
||
task :default => :test | ||
|
||
require 'rake/rdoctask' | ||
Rake::RDocTask.new do |rdoc| | ||
version = File.exist?('VERSION') ? File.read('VERSION') : "" | ||
|
||
rdoc.rdoc_dir = 'rdoc' | ||
rdoc.title = "active_merchant_tranzila #{version}" | ||
rdoc.rdoc_files.include('README*') | ||
rdoc.rdoc_files.include('lib/**/*.rb') | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0.0.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Generated by jeweler | ||
# DO NOT EDIT THIS FILE DIRECTLY | ||
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command | ||
# -*- encoding: utf-8 -*- | ||
|
||
Gem::Specification.new do |s| | ||
s.name = %q{active_merchant_tranzila} | ||
s.version = "0.0.1" | ||
|
||
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= | ||
s.authors = ["Vitaly Kushner"] | ||
s.date = %q{2010-08-11} | ||
s.description = %q{TODO: longer description of your gem} | ||
s.email = %q{[email protected]} | ||
s.extra_rdoc_files = [ | ||
"LICENSE", | ||
"README.markdown" | ||
] | ||
s.files = [ | ||
"LICENSE", | ||
"README.markdown", | ||
"Rakefile", | ||
"lib/active_merchant/billing/gateways/tranzila.rb", | ||
"lib/active_merchant_tranzila.rb", | ||
"test/helper.rb", | ||
"test/remote/gateways/remote_tranzila_test.rb", | ||
"test/unit/gateways/tranzila_test.rb" | ||
] | ||
s.homepage = %q{http://github.com/vitaly/active_merchant_tranzila} | ||
s.rdoc_options = ["--charset=UTF-8"] | ||
s.require_paths = ["lib"] | ||
s.rubygems_version = %q{1.3.6} | ||
s.summary = %q{TODO: one-line summary of your gem} | ||
s.test_files = [ | ||
"test/helper.rb", | ||
"test/remote/gateways/remote_tranzila_test.rb", | ||
"test/unit/gateways/tranzila_test.rb" | ||
] | ||
|
||
if s.respond_to? :specification_version then | ||
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION | ||
s.specification_version = 3 | ||
|
||
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then | ||
else | ||
end | ||
else | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
require 'active_merchant/billing/gateways/tranzila' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
require 'rubygems' | ||
require 'test/unit' | ||
require 'mocha' | ||
|
||
|
||
$LOAD_PATH.unshift(File.dirname(__FILE__)) | ||
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) | ||
require 'active_merchant_tranzila' | ||
|
||
ActiveMerchant::Billing::Base.mode = :test | ||
|
||
module ActiveMerchant | ||
module Assertions | ||
AssertionClass = RUBY_VERSION > '1.9' ? MiniTest::Assertion : Test::Unit::AssertionFailedError | ||
|
||
def assert_field(field, value) | ||
clean_backtrace do | ||
assert_equal value, @helper.fields[field] | ||
end | ||
end | ||
|
||
# Allows the testing of you to check for negative assertions: | ||
# | ||
# # Instead of | ||
# assert !something_that_is_false | ||
# | ||
# # Do this | ||
# assert_false something_that_should_be_false | ||
# | ||
# An optional +msg+ parameter is available to help you debug. | ||
def assert_false(boolean, message = nil) | ||
message = build_message message, '<?> is not false or nil.', boolean | ||
|
||
clean_backtrace do | ||
assert_block message do | ||
not boolean | ||
end | ||
end | ||
end | ||
|
||
# A handy little assertion to check for a successful response: | ||
# | ||
# # Instead of | ||
# assert_success response | ||
# | ||
# # DRY that up with | ||
# assert_success response | ||
# | ||
# A message will automatically show the inspection of the response | ||
# object if things go afoul. | ||
def assert_success(response) | ||
clean_backtrace do | ||
assert response.success?, "Response failed: #{response.inspect}" | ||
end | ||
end | ||
|
||
# The negative of +assert_success+ | ||
def assert_failure(response) | ||
clean_backtrace do | ||
assert_false response.success?, "Response expected to fail: #{response.inspect}" | ||
end | ||
end | ||
|
||
def assert_valid(validateable) | ||
clean_backtrace do | ||
assert validateable.valid?, "Expected to be valid" | ||
end | ||
end | ||
|
||
def assert_not_valid(validateable) | ||
clean_backtrace do | ||
assert_false validateable.valid?, "Expected to not be valid" | ||
end | ||
end | ||
|
||
private | ||
def clean_backtrace(&block) | ||
yield | ||
rescue AssertionClass => e | ||
path = File.expand_path(__FILE__) | ||
raise AssertionClass, e.message, e.backtrace.reject { |line| File.expand_path(line) =~ /#{path}/ } | ||
end | ||
end | ||
|
||
module Fixtures | ||
private | ||
def credit_card(number = '4242424242424242', options = {}) | ||
defaults = { | ||
:number => number, | ||
:month => 9, | ||
:year => Time.now.year + 1, | ||
:first_name => 'Longbob', | ||
:last_name => 'Longsen', | ||
:verification_value => '123', | ||
:type => 'visa' | ||
}.update(options) | ||
|
||
Billing::CreditCard.new(defaults) | ||
end | ||
end | ||
end | ||
|
||
class Test::Unit::TestCase | ||
include ActiveMerchant::Billing | ||
include ActiveMerchant::Fixtures | ||
include ActiveMerchant::Assertions | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters