skink 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/skink/client/base.rb +1 -1
- data/lib/skink/client/response.rb +4 -0
- data/lib/skink/rack_test_client/rack_test_client.rb +1 -1
- data/lib/skink/rack_test_client/rack_test_response.rb +4 -0
- data/lib/skink/resourceful_client/resourceful_client.rb +7 -3
- data/lib/skink/resourceful_client/resourceful_response.rb +4 -0
- data/lib/skink/version.rb +1 -1
- data/skink.gemspec +2 -2
- data/spec/skink_dsl_spec.rb +8 -1
- data/spec/spec_helper.rb +0 -4
- metadata +3 -3
data/lib/skink/client/base.rb
CHANGED
@@ -18,9 +18,13 @@ class ResourcefulClient < Client::Base
|
|
18
18
|
@http_accessor ||= Resourceful::HttpAccessor.new
|
19
19
|
end
|
20
20
|
|
21
|
-
def with_basic_auth(user_name, password)
|
22
|
-
|
23
|
-
|
21
|
+
def with_basic_auth(user_name, password, realm = nil)
|
22
|
+
authenticator = if realm.nil?
|
23
|
+
Resourceful::PromiscuousBasicAuthenticator.new(user_name, password)
|
24
|
+
else
|
25
|
+
Resourceful::BasicAuthenticator.new(realm, user_name, password)
|
26
|
+
end
|
27
|
+
http_accessor.add_authenticator authenticator
|
24
28
|
end
|
25
29
|
|
26
30
|
def with_header(name, value)
|
data/lib/skink/version.rb
CHANGED
data/skink.gemspec
CHANGED
@@ -8,9 +8,9 @@ Gem::Specification.new do |gem|
|
|
8
8
|
gem.version = Skink::VERSION
|
9
9
|
gem.authors = ["Todd Thomas"]
|
10
10
|
gem.email = ["todd.thomas@openlogic.com"]
|
11
|
-
gem.description = %q{A DSL for testing REST APIs}
|
11
|
+
gem.description = %q{A Ruby DSL for testing REST APIs.}
|
12
12
|
gem.summary = %q{Skink is Capybara's smaller, more primitive companion.}
|
13
|
-
gem.homepage = ""
|
13
|
+
gem.homepage = "https://github.com/toddthomas/skink.git"
|
14
14
|
|
15
15
|
gem.add_dependency "rack-test"
|
16
16
|
gem.add_dependency "openlogic-resourceful"
|
data/spec/skink_dsl_spec.rb
CHANGED
@@ -43,10 +43,17 @@ shared_examples "a REST API test language" do
|
|
43
43
|
end
|
44
44
|
|
45
45
|
it "is able to test requests which require basic authentication" do
|
46
|
+
with_basic_auth "admin", "admin"
|
47
|
+
get "/protected"
|
48
|
+
response.status_code.should == 200
|
49
|
+
response.body.should == "Welcome, authenticated client."
|
50
|
+
end
|
51
|
+
|
52
|
+
it "is able to test requests which require basic authentication for specified realm" do
|
46
53
|
get "/protected"
|
47
54
|
response.status_code.should == 401
|
48
55
|
|
49
|
-
with_basic_auth "admin", "admin"
|
56
|
+
with_basic_auth "admin", "admin", "Restricted Area"
|
50
57
|
get "/protected"
|
51
58
|
response.status_code.should == 200
|
52
59
|
response.body.should == "Welcome, authenticated client."
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: skink
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -75,7 +75,7 @@ dependencies:
|
|
75
75
|
- - ! '>='
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: '0'
|
78
|
-
description: A DSL for testing REST APIs
|
78
|
+
description: A Ruby DSL for testing REST APIs.
|
79
79
|
email:
|
80
80
|
- todd.thomas@openlogic.com
|
81
81
|
executables: []
|
@@ -102,7 +102,7 @@ files:
|
|
102
102
|
- spec/skink_dsl_spec.rb
|
103
103
|
- spec/spec_helper.rb
|
104
104
|
- spec/test_server.rb
|
105
|
-
homepage:
|
105
|
+
homepage: https://github.com/toddthomas/skink.git
|
106
106
|
licenses: []
|
107
107
|
post_install_message:
|
108
108
|
rdoc_options: []
|