curacao 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Gemfile +6 -0
- data/LICENSE.md +21 -0
- data/README.md +9 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/curacao.gemspec +26 -0
- data/lib/curacao/matcher/exit_with_status.rb +13 -0
- data/lib/curacao/matcher/have_content.rb +62 -0
- data/lib/curacao/matcher.rb +1 -0
- data/lib/curacao/version.rb +3 -0
- data/lib/curacao.rb +7 -0
- metadata +115 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 58426f81c9b08008a5069dcc6f38c092538648d7
|
4
|
+
data.tar.gz: e1df951a664043689eab832ddb4e30426abd525f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 41b84bb06433efc42822febd2002a738be99ac197907f2de0998d1c211948d6e3cad02f3ea9ab5df018994cd6d800d4fe0b7926441d471d3c6898aa5b3a4df52
|
7
|
+
data.tar.gz: 3e6f24e29c8815b1a4506dfd7f8e55974e21dce2095c5743c0068c9856a9dbcadfe6470424f06322523fa0d1310feed87e3af6f916d0c0bc1ca5d9f8ac6cd44d
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 pikesley
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
[![Build Status](http://img.shields.io/travis/pikesley/curacao.svg?style=flat-square)](https://travis-ci.org/pikesley/curacao)
|
2
|
+
[![Dependency Status](http://img.shields.io/gemnasium/pikesley/curacao.svg?style=flat-square)](https://gemnasium.com/pikesley/curacao)
|
3
|
+
[![Coverage Status](http://img.shields.io/coveralls/pikesley/curacao.svg?style=flat-square)](https://coveralls.io/r/pikesley/curacao)
|
4
|
+
[![Code Climate](http://img.shields.io/codeclimate/github/pikesley/curacao.svg?style=flat-square)](https://codeclimate.com/github/pikesley/curacao)
|
5
|
+
[![Gem Version](http://img.shields.io/gem/v/curacao.svg?style=flat-square)](https://rubygems.org/gems/curacao)
|
6
|
+
[![License](http://img.shields.io/:license-mit-blue.svg?style=flat-square)](http://pikesley.mit-license.org)
|
7
|
+
[![Badges](http://img.shields.io/:badges-7/7-ff6799.svg?style=flat-square)](https://github.com/badges/badgerbadgerbadger)
|
8
|
+
|
9
|
+
# Curacao
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "curacao"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/curacao.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'curacao/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'curacao'
|
8
|
+
spec.version = Curacao::VERSION
|
9
|
+
spec.authors = ['pikesley']
|
10
|
+
spec.email = ['github@orgraphone.org']
|
11
|
+
|
12
|
+
spec.summary = 'Rspec extensions'
|
13
|
+
spec.description = 'Rspec extensions'
|
14
|
+
spec.homepage = 'http://github.com'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = 'exe'
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ['lib']
|
21
|
+
|
22
|
+
spec.add_development_dependency 'bundler', '~> 1.7'
|
23
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
24
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
25
|
+
spec.add_development_dependency 'coveralls', '~> 0.8'
|
26
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
RSpec::Matchers.define :exit_with_status do |expected|
|
2
|
+
match do |actual|
|
3
|
+
expect { actual.call }.to raise_error(SystemExit)
|
4
|
+
|
5
|
+
begin
|
6
|
+
actual.call
|
7
|
+
rescue SystemExit => e
|
8
|
+
expect(e.status).to eq expected
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
supports_block_expectations
|
13
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
RSpec.configure do |config|
|
2
|
+
# Use tmp/ to write files
|
3
|
+
$pwd = FileUtils.pwd
|
4
|
+
config.before(:each) do
|
5
|
+
FileUtils.rm_rf 'tmp'
|
6
|
+
FileUtils.mkdir_p 'tmp'
|
7
|
+
FileUtils.cd 'tmp'
|
8
|
+
end
|
9
|
+
|
10
|
+
config.after(:each) do
|
11
|
+
FileUtils.cd $pwd
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
RSpec::Matchers.define :have_content do |expected|
|
16
|
+
match do |actual|
|
17
|
+
actual = File.read actual
|
18
|
+
|
19
|
+
pass = true
|
20
|
+
expected.contentise.each_with_index do |line, index|
|
21
|
+
unless line.matches actual.contentise[index]
|
22
|
+
pass = false
|
23
|
+
end
|
24
|
+
end
|
25
|
+
pass
|
26
|
+
end
|
27
|
+
|
28
|
+
failure_message do |actual|
|
29
|
+
"expected #{expected} to match #{File.read actual}"
|
30
|
+
end
|
31
|
+
|
32
|
+
failure_message_when_negated do |actual|
|
33
|
+
"expected #{expected} to not match #{File.read actual}"
|
34
|
+
end
|
35
|
+
|
36
|
+
description do
|
37
|
+
'matches file content against expectation'
|
38
|
+
end
|
39
|
+
end
|
40
|
+
RSpec::Matchers.alias_matcher :with_content, :have_content
|
41
|
+
|
42
|
+
class String
|
43
|
+
def contentise
|
44
|
+
# split into lines, strip spaces from ends, ding blank lines
|
45
|
+
self.strip.split("\n").map { |l| l.strip }.reject { |l| l == '' }
|
46
|
+
end
|
47
|
+
|
48
|
+
def matches other
|
49
|
+
if self.is_regex
|
50
|
+
return ! (self.to_regex.match other).nil?
|
51
|
+
end
|
52
|
+
self == other
|
53
|
+
end
|
54
|
+
|
55
|
+
def is_regex
|
56
|
+
! /^\/.*\/$/.match(self.strip).nil?
|
57
|
+
end
|
58
|
+
|
59
|
+
def to_regex
|
60
|
+
Regexp.new self[1..-2]
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'curacao/matcher/have_content'
|
data/lib/curacao.rb
ADDED
metadata
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: curacao
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- pikesley
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-01-16 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.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: coveralls
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.8'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.8'
|
69
|
+
description: Rspec extensions
|
70
|
+
email:
|
71
|
+
- github@orgraphone.org
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".rspec"
|
78
|
+
- ".travis.yml"
|
79
|
+
- Gemfile
|
80
|
+
- LICENSE.md
|
81
|
+
- README.md
|
82
|
+
- Rakefile
|
83
|
+
- bin/console
|
84
|
+
- bin/setup
|
85
|
+
- curacao.gemspec
|
86
|
+
- lib/curacao.rb
|
87
|
+
- lib/curacao/matcher.rb
|
88
|
+
- lib/curacao/matcher/exit_with_status.rb
|
89
|
+
- lib/curacao/matcher/have_content.rb
|
90
|
+
- lib/curacao/version.rb
|
91
|
+
homepage: http://github.com
|
92
|
+
licenses:
|
93
|
+
- MIT
|
94
|
+
metadata: {}
|
95
|
+
post_install_message:
|
96
|
+
rdoc_options: []
|
97
|
+
require_paths:
|
98
|
+
- lib
|
99
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
requirements: []
|
110
|
+
rubyforge_project:
|
111
|
+
rubygems_version: 2.5.1
|
112
|
+
signing_key:
|
113
|
+
specification_version: 4
|
114
|
+
summary: Rspec extensions
|
115
|
+
test_files: []
|