Skip to content

Commit 4963f59

Browse files
committed
Merge pull request #13 from dasch/dasch/cleanup
Make the tests work again
2 parents 85a9380 + c26218a commit 4963f59

File tree

9 files changed

+30
-40
lines changed

9 files changed

+30
-40
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ language: ruby
22
rvm:
33
- 1.9.3
44
- 2.0.0
5-
- 2.1.0
5+
- 2.1.1

Gemfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
source "http://rubygems.org"
22

33
gemspec
4-
5-
gem "shoulda", :git => "git://github.com/dasch/shoulda.git", :branch => "minitest"

test/bittorrent_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require 'environment'
22

3-
class BitTorrentTest < MiniTest::Unit::TestCase
4-
should "load a bencoded torrent file" do
3+
describe "bittorrent" do
4+
it "should load a bencoded torrent file" do
55
BEncode.load_file("test/fixtures/python.torrent")
66
pass
77
end

test/decoding_test.rb

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
require 'environment'
22

3-
class DecodingTest < MiniTest::Unit::TestCase
4-
context "The BEncode decoder" do
5-
should_decode 42, "i42e"
6-
should_decode 0, "i0e"
7-
should_decode -42, "i-42e"
3+
describe "decoding" do
4+
it_should_decode 42, "i42e"
5+
it_should_decode 0, "i0e"
6+
it_should_decode -42, "i-42e"
87

9-
should_decode "foo", "3:foo"
10-
should_decode "", "0:"
8+
it_should_decode "foo", "3:foo"
9+
it_should_decode "", "0:"
1110

12-
should_decode [1, 2, 3], "li1ei2ei3ee"
13-
14-
hsh = {"foo" => "bar", "baz" => "qux"}
15-
should_decode hsh, "d3:foo3:bar3:baz3:quxe"
16-
17-
should_decode 42, "i42eBOGUS", :ignore_trailing_junk => true
18-
end
11+
it_should_decode [1, 2, 3], "li1ei2ei3ee"
12+
13+
hsh = {"foo" => "bar", "baz" => "qux"}
14+
it_should_decode hsh, "d3:foo3:bar3:baz3:quxe"
15+
16+
it_should_decode 42, "i42eBOGUS", :ignore_trailing_junk => true
1917
end

test/encoding_test.rb

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
# encoding: utf-8
22
require 'environment'
33

4-
class EncodingTest < MiniTest::Unit::TestCase
5-
context "The BEncode encoder" do
6-
should_encode "i42e", 42
7-
should_encode "3:foo", "foo"
8-
should_encode "5:café", "café"
9-
end
4+
describe "encoding" do
5+
it_should_encode "i42e", 42
6+
it_should_encode "3:foo", "foo"
7+
it_should_encode "5:café", "café"
108
end

test/environment.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
require 'rubygems'
22
require 'bundler/setup'
33

4-
require 'minitest/unit'
4+
require 'minitest/autorun'
55
require 'shoulda'
66

7-
MiniTest::Unit.autorun
8-
97
require File.dirname(__FILE__) + '/../lib/bencode'
108
Dir.glob(File.dirname(__FILE__) + '/shoulda_macros/*.rb').each do |macro|
119
require macro

test/shoulda_macros/decoding.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

2-
class MiniTest::Unit::TestCase
3-
def self.should_decode(expected, encoded, opts = {})
4-
should "decode #{encoded.inspect} into #{expected.inspect}" do
2+
class MiniTest::Test
3+
def self.it_should_decode(expected, encoded, opts = {})
4+
it "should decode #{encoded.inspect} into #{expected.inspect}" do
55
assert_equal expected, BEncode.load(encoded, opts)
66
end
77
end

test/shoulda_macros/encoding.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

2-
class MiniTest::Unit::TestCase
3-
def self.should_encode(expected, value)
4-
should "encode #{value.inspect} into #{expected.inspect}" do
2+
class MiniTest::Test
3+
def self.it_should_encode(expected, value)
4+
it "should encode #{value.inspect} into #{expected.inspect}" do
55
assert_equal expected, value.bencode
66
end
77
end

test/utf8_decoding_test.rb

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
require 'environment'
22

3-
class UTF8DecodingTest < MiniTest::Unit::TestCase
4-
context "The BEncode decoder" do
5-
should "be able to handle UTF8-encoded data" do
6-
BEncode.load_file('test/fixtures/test.torrent')
7-
pass
8-
end
3+
describe "utf encoding" do
4+
it "should be able to handle UTF8-encoded data" do
5+
BEncode.load_file('test/fixtures/test.torrent')
6+
pass
97
end
108
end

0 commit comments

Comments
 (0)