thumblemonks-chicago 0.3.2.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +17 -7
- data/chicago.gemspec +2 -2
- data/lib/chicago/protest/macros.rb +7 -7
- data/lib/chicago/shoulda/sinatra.rb +1 -1
- data/test/application_test.rb +1 -1
- metadata +2 -2
data/Rakefile
CHANGED
@@ -1,23 +1,33 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'rake'
|
3
|
+
require 'rake/testtask'
|
3
4
|
|
4
5
|
desc 'Default task: run all tests'
|
5
6
|
task :default => [:test]
|
6
7
|
|
7
|
-
task(:set_test_env) { ENV['
|
8
|
-
|
9
|
-
task :environment do
|
10
|
-
# Nothing yet
|
11
|
-
end
|
8
|
+
task(:set_test_env) { ENV['RACK_ENV'] ||= 'test' }
|
12
9
|
|
13
10
|
desc "Run all tests"
|
14
|
-
task :test => [:set_test_env
|
11
|
+
task :test => [:set_test_env] do
|
15
12
|
require 'protest'
|
16
13
|
$:.concat ['./lib', './test']
|
17
14
|
Dir.glob("./test/*_test.rb").each { |test| require test }
|
18
|
-
Protest.
|
15
|
+
Protest.report
|
19
16
|
end
|
20
17
|
|
18
|
+
task "test:shoulda" => [:set_test_env]
|
19
|
+
desc "Run all Shoulda based tests"
|
20
|
+
Rake::TestTask.new("test:shoulda") do |t|
|
21
|
+
t.libs << "test/shoulda_tests"
|
22
|
+
t.test_files = FileList['test/shoulda_tests/*_test.rb']
|
23
|
+
t.verbose = true
|
24
|
+
end
|
25
|
+
|
26
|
+
# task :test => [:set_test_env] do
|
27
|
+
# $:.concat ['./lib', './test/shoulda_tests']
|
28
|
+
# Dir.glob("./test/shoulda_tests/*_test.rb").each { |test| require test }
|
29
|
+
# end
|
30
|
+
|
21
31
|
desc "Open an irb session preloaded with this library"
|
22
32
|
task :console do
|
23
33
|
exec "irb -rubygems"
|
data/chicago.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "chicago"
|
3
|
-
s.version = "0.3.
|
4
|
-
s.date = "2009-
|
3
|
+
s.version = "0.3.3"
|
4
|
+
s.date = "2009-07-05"
|
5
5
|
s.summary = "Sinatra runtime and testing extensions used commonly by Thumblemonks"
|
6
6
|
s.email = %w[gus@gusg.us gabriel.gironda@gmail.com]
|
7
7
|
s.homepage = "http://github.com/thumblemonks/chicago/tree/master"
|
@@ -4,29 +4,29 @@ module Chicago
|
|
4
4
|
module Protest
|
5
5
|
module Macros
|
6
6
|
def asserts_response_status(expected)
|
7
|
-
asserts("response status is #{expected}")
|
7
|
+
asserts("response status is #{expected}") { last_response.status }.equals(expected)
|
8
8
|
end
|
9
9
|
|
10
10
|
def asserts_content_type(expected)
|
11
|
-
asserts("content type is #{expected}")
|
11
|
+
asserts("content type is #{expected}") { last_response.headers['Content-type'] }.equals(expected)
|
12
12
|
end
|
13
13
|
|
14
14
|
def asserts_response_body(expected)
|
15
|
-
asserts("response body matches #{expected.inspect}")
|
15
|
+
asserts("response body matches #{expected.inspect}") { last_response.body }.matches(expected)
|
16
16
|
end
|
17
17
|
|
18
18
|
def asserts_location(expected_path)
|
19
|
-
asserts("location matches #{expected_path}")
|
19
|
+
asserts("location matches #{expected_path}") do
|
20
20
|
last_response.headers["Location"]
|
21
|
-
end
|
21
|
+
end.matches(expected_path)
|
22
22
|
end
|
23
23
|
|
24
24
|
def asserts_json_response(json, &block)
|
25
25
|
asserts_content_type 'application/json'
|
26
|
-
asserts("response body has JSON")
|
26
|
+
asserts("response body has JSON") do
|
27
27
|
json = json.to_json unless json.instance_of?(String)
|
28
28
|
json
|
29
|
-
end
|
29
|
+
end.equals(last_response.body)
|
30
30
|
end
|
31
31
|
|
32
32
|
# Usage:
|
data/test/application_test.rb
CHANGED
@@ -36,7 +36,7 @@ context "Application Test:" do
|
|
36
36
|
context "with path that's not a defined a sass file" do
|
37
37
|
setup { get '/stylesheets/zoo.css' }
|
38
38
|
asserts_response_status 404
|
39
|
-
asserts_content_type 'text/
|
39
|
+
asserts_content_type 'text/css'
|
40
40
|
end
|
41
41
|
end # catching all css
|
42
42
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thumblemonks-chicago
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Knowlden
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2009-
|
13
|
+
date: 2009-07-05 00:00:00 -07:00
|
14
14
|
default_executable:
|
15
15
|
dependencies: []
|
16
16
|
|