Skip to content

Commit f9308e8

Browse files
committed
migrated tests from rspec to minitest
1 parent 58978bb commit f9308e8

File tree

8 files changed

+71
-6
lines changed

8 files changed

+71
-6
lines changed

.rvmrc

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
rvm_gemset_create_on_use_flag=1
2-
rvm use ruby-1.9.2-p180@css2sass
1+
rvm ruby-1.9.2-p290@css2sass

Gemfile

+1-4
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ gem 'rack-flash'
1212
gem 'sinatra-redirect-with-flash'
1313

1414
group :development, :test do
15-
gem 'rspec'
16-
gem 'webrat'
17-
gem 'rspec-core'
18-
gem 'rspec-instafail'
1915
gem 'rack-test'
2016
gem 'awesome_print'
2117
gem 'libnotify'
@@ -24,4 +20,5 @@ group :development, :test do
2420
gem 'rb-inotify'
2521
gem 'shotgun'
2622
gem 'heroku'
23+
gem 'ZenTest'
2724
end

Gemfile.lock

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
GEM
22
remote: http://rubygems.org/
33
specs:
4+
ZenTest (4.6.2)
45
awesome_print (0.4.0)
56
builder (3.0.0)
67
configuration (1.3.1)
@@ -70,6 +71,7 @@ PLATFORMS
7071
ruby
7172

7273
DEPENDENCIES
74+
ZenTest
7375
awesome_print
7476
builder
7577
erubis

css2sass.rb

100755100644
File mode changed.

static/stylesheets/960.css

100755100644
File mode changed.

static/stylesheets/reset.css

100755100644
File mode changed.

static/stylesheets/text.css

100755100644
File mode changed.

test/test_css2sass.rb

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
require File.dirname(__FILE__) + '/../css2sass'
2+
require 'minitest/autorun'
3+
require 'rack/test'
4+
5+
class TestCss2sass < MiniTest::Unit::TestCase
6+
def setup
7+
@browser = Rack::Test::Session.new(Rack::MockSession.new(Css2sass))
8+
end
9+
10+
def test_it_says_hello_world
11+
@browser.get '/'
12+
assert @browser.last_response.ok?
13+
assert_match home_title, @browser.last_response.body
14+
end
15+
16+
def test_api_speak_json
17+
p @browser.post '/json', json_post
18+
assert @browser.last_response.ok?
19+
assert_match json_response, @browser.last_response.body
20+
end
21+
22+
def test_api_speak_xml
23+
p @browser.post '/xml', xml_post
24+
assert @browser.last_response.ok?
25+
assert_match xml_response, @browser.last_response.body
26+
27+
end
28+
29+
def home_title
30+
'<title>' +
31+
'css2sass | Convert CSS Snippets to Syntactically Awesome StyleSheets code' +
32+
'</title>'
33+
end
34+
35+
def json_post
36+
{ :page =>
37+
{ :css => ".content-navigation { border-color: #3bbfce; color: #2b9eab; }"
38+
}
39+
}
40+
end
41+
42+
def json_response
43+
'{"page":' +
44+
'{"css":".content-navigation { border-color: #3bbfce; color: #2b9eab; }",'+
45+
'"sass":".content-navigation\n border-color: #3bbfce\n color: #2b9eab\n"}}'
46+
end
47+
48+
def xml_post
49+
{ :page =>
50+
{ :css => ".content-navigation { border-color: #3bbfce; color: #2b9eab; }"
51+
}
52+
}
53+
end
54+
55+
def xml_response
56+
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
57+
"<page>\n " +
58+
"<css>\n " +
59+
"<![CDATA[.content-navigation { border-color: #3bbfce; color: #2b9eab; }]]>\n " +
60+
"</css>\n " +
61+
"<sass>\n " +
62+
"<![CDATA[.content-navigation\n border-color: #3bbfce\n color: #2b9eab\n]]>\n " +
63+
"</sass>\n" +
64+
"</page>\n"
65+
end
66+
67+
end

0 commit comments

Comments
 (0)