spryte 0.0.1.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +23 -0
- data/Gemfile +2 -0
- data/LICENSE.txt +22 -0
- data/README.md +2 -0
- data/Rakefile +2 -0
- data/lib/spryte/rspec/helpers.rb +18 -0
- data/lib/spryte/rspec/matchers.rb +57 -0
- data/lib/spryte/rspec.rb +6 -0
- data/lib/spryte/version.rb +6 -0
- data/lib/spryte.rb +4 -0
- data/spryte.gemspec +29 -0
- metadata +83 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6e639529b352ab22e87235c3bfafaaa1b6184458
|
4
|
+
data.tar.gz: 3cde86f14f66b958539995879764005427c098e2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: eefb309eb6c1a23db25f5273d9741a0f5b77892e1f4eb8a9cd96cd25c6adc68d6e2ff2b012568ea286c7e1d3cdb818a56d6c952ec5167d9bf9ea4a0d53ccba21
|
7
|
+
data.tar.gz: 9a13781c2a041f9e54c87b65b92ad7c15d4098b44c4ab87045161f0086222c8060bf0a695eb15b68fabe024317be6c646ad91cb645b90e79dbc6bc10e6a35b17
|
data/.gitignore
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/test/tmp/
|
9
|
+
/test/version_tmp/
|
10
|
+
/tmp/
|
11
|
+
.dat*
|
12
|
+
.repl_history
|
13
|
+
build/
|
14
|
+
/.yardoc/
|
15
|
+
/_yardoc/
|
16
|
+
/doc/
|
17
|
+
/rdoc/
|
18
|
+
/.bundle/
|
19
|
+
/lib/bundler/man/
|
20
|
+
Gemfile.lock
|
21
|
+
.ruby-version
|
22
|
+
.ruby-gemset
|
23
|
+
.rvmrc
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Philip Vieira
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
module Spryte
|
2
|
+
module RSpec
|
3
|
+
module Helpers
|
4
|
+
|
5
|
+
def json
|
6
|
+
expect(response.body).to_not be_empty, lambda { "Expected there to be a JSON root, but the response body is empty." }
|
7
|
+
@json ||= JSON.parse(response.body).with_indifferent_access
|
8
|
+
rescue JSON::ParserError
|
9
|
+
raise "Invalid JSON response:\n\n#{response.body}"
|
10
|
+
end
|
11
|
+
|
12
|
+
def errors
|
13
|
+
json.fetch(:errors) { [] }
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
RSpec::Matchers.define :have_status do |type, message = nil|
|
2
|
+
|
3
|
+
match do |_response|
|
4
|
+
assert_response type, message
|
5
|
+
end
|
6
|
+
|
7
|
+
end
|
8
|
+
|
9
|
+
RSpec::Matchers.define :have_content_type do |type, message = nil|
|
10
|
+
|
11
|
+
match do |_response|
|
12
|
+
actual(_response).include?(type)
|
13
|
+
end
|
14
|
+
|
15
|
+
description do
|
16
|
+
"has the #{ type } content type"
|
17
|
+
end
|
18
|
+
|
19
|
+
failure_message do |_response|
|
20
|
+
"expected content type to be '#{ type }' but it was '#{ actual(_response) }'"
|
21
|
+
end
|
22
|
+
|
23
|
+
failure_message_when_negated do |_response|
|
24
|
+
"expected content type not to be '#{ type }' but it was '#{ actual(_response) }'"
|
25
|
+
end
|
26
|
+
|
27
|
+
define_method :actual do |_response|
|
28
|
+
_response.headers["Content-Type"]
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
RSpec::Matchers.define :have_errors do |expected|
|
34
|
+
|
35
|
+
match do |actual|
|
36
|
+
errors.any?
|
37
|
+
end
|
38
|
+
|
39
|
+
failure_message do |actual|
|
40
|
+
errors = formatted_errors
|
41
|
+
message = "expected there to be errors"
|
42
|
+
message += ", these were found:\n\n#{ errors.join("\n\n") }" if errors.any?
|
43
|
+
message
|
44
|
+
end
|
45
|
+
|
46
|
+
failure_message_when_negated do |actual|
|
47
|
+
errors = formatted_errors
|
48
|
+
message = "expected there to be no errors"
|
49
|
+
message += ", these were found:\n\n#{ errors.join("\n\n") }" if errors.any?
|
50
|
+
message
|
51
|
+
end
|
52
|
+
|
53
|
+
def formatted_errors
|
54
|
+
errors.map{ |e| e.to_yaml.split("\n",2).last }
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
data/lib/spryte/rspec.rb
ADDED
data/lib/spryte.rb
ADDED
data/spryte.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'spryte/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
|
8
|
+
spec.name = "spryte"
|
9
|
+
|
10
|
+
spec.version = Spryte::VERSION
|
11
|
+
|
12
|
+
spec.authors = ["Philip Vieira"]
|
13
|
+
spec.email = ["philip@chatspry.com"]
|
14
|
+
|
15
|
+
spec.summary = %q{API builder tools for Ruby on Rails}
|
16
|
+
spec.description = %q{API builder tools for Ruby on Rails}
|
17
|
+
|
18
|
+
spec.homepage = "https://github.com/chatspry/spryte"
|
19
|
+
spec.license = "MIT"
|
20
|
+
|
21
|
+
spec.files = `git ls-files -z`.split("\x0")
|
22
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
23
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
24
|
+
spec.require_paths = ["lib"]
|
25
|
+
|
26
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
27
|
+
spec.add_development_dependency "rake"
|
28
|
+
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: spryte
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1.pre1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Philip Vieira
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-08-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.6'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: API builder tools for Ruby on Rails
|
42
|
+
email:
|
43
|
+
- philip@chatspry.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- Gemfile
|
50
|
+
- LICENSE.txt
|
51
|
+
- README.md
|
52
|
+
- Rakefile
|
53
|
+
- lib/spryte.rb
|
54
|
+
- lib/spryte/rspec.rb
|
55
|
+
- lib/spryte/rspec/helpers.rb
|
56
|
+
- lib/spryte/rspec/matchers.rb
|
57
|
+
- lib/spryte/version.rb
|
58
|
+
- spryte.gemspec
|
59
|
+
homepage: https://github.com/chatspry/spryte
|
60
|
+
licenses:
|
61
|
+
- MIT
|
62
|
+
metadata: {}
|
63
|
+
post_install_message:
|
64
|
+
rdoc_options: []
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 1.3.1
|
77
|
+
requirements: []
|
78
|
+
rubyforge_project:
|
79
|
+
rubygems_version: 2.2.2
|
80
|
+
signing_key:
|
81
|
+
specification_version: 4
|
82
|
+
summary: API builder tools for Ruby on Rails
|
83
|
+
test_files: []
|