melee 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +5 -0
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/README.md +59 -0
- data/Rakefile +14 -0
- data/lib/melee.rb +30 -0
- data/lib/melee/version.rb +3 -0
- data/melee.gemspec +22 -0
- data/test/acceptance/acceptance_helper.rb +29 -0
- data/test/acceptance/basic_test.rb +61 -0
- metadata +77 -0
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
Copyright (c) 2011 Arthur Chiu
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
data/README.md
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
### Melee: A minimalist acceptance test solution for Riot ###
|
2
|
+
|
3
|
+
Melee is an acceptance test solution for [Riot](http://thumblemonks.github.com/riot/), like [Steak](https://github.com/cavalle/steak) is to
|
4
|
+
[Rspec](http://rspec.info/).
|
5
|
+
|
6
|
+
|
7
|
+
#### Installation ####
|
8
|
+
|
9
|
+
just install the gem:
|
10
|
+
|
11
|
+
gem install melee
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
#### Some Examples ####
|
16
|
+
|
17
|
+
Here's how melee looks like for the unitiated.
|
18
|
+
|
19
|
+
|
20
|
+
# Same as the context method
|
21
|
+
feature %Q{
|
22
|
+
To write better software
|
23
|
+
as a ruby developer and a riot user
|
24
|
+
I need to write me some acceptance test
|
25
|
+
} do
|
26
|
+
|
27
|
+
# Same as the setup method
|
28
|
+
background { "that i'm no different than setup" }
|
29
|
+
|
30
|
+
# Same as the asserts method
|
31
|
+
scenario "With some background, it should really be no different than a setup" do
|
32
|
+
topic =~ /setup/
|
33
|
+
end
|
34
|
+
|
35
|
+
# Synonmous to the helper method in riot
|
36
|
+
given(:a_string) { "yay for acceptance test" }
|
37
|
+
|
38
|
+
scenario "With some string that I have, it should ensure that the string" do
|
39
|
+
a_string
|
40
|
+
end.matches %r{acceptance} # Takes the same macros
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
If you know how to use riot, you already know how to use melee. Melee
|
45
|
+
provides alias for most of the methods you use in riot to provide you
|
46
|
+
that acceptance test feel.
|
47
|
+
|
48
|
+
#### Contribute ####
|
49
|
+
|
50
|
+
- Fork the project.
|
51
|
+
- Make your feature addition or bug fix.
|
52
|
+
- Add tests for it. This is important so I don't break it in a future version unintentionally.
|
53
|
+
- Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
54
|
+
- Send me a pull request. Bonus points for topic branches.
|
55
|
+
|
56
|
+
#### Copyright ####
|
57
|
+
|
58
|
+
Copyright (c) 2011 Arthur Chiu. See LICENSE for details.
|
59
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
Bundler::GemHelper.install_tasks
|
3
|
+
|
4
|
+
task :default => [:test]
|
5
|
+
|
6
|
+
require 'rake/testtask'
|
7
|
+
Rake::TestTask.new(:test) do |test|
|
8
|
+
test.libs << 'lib' << 'test'
|
9
|
+
test.pattern = 'test/**/*_test.rb'
|
10
|
+
test.verbose = true
|
11
|
+
end
|
12
|
+
|
13
|
+
|
14
|
+
|
data/lib/melee.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'riot'
|
2
|
+
|
3
|
+
module Melee
|
4
|
+
|
5
|
+
module Context
|
6
|
+
|
7
|
+
def self.included(klass)
|
8
|
+
klass.class_eval do
|
9
|
+
alias :background :setup
|
10
|
+
alias :given :helper
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def scenario(what, &definition)
|
15
|
+
new_assertion "scenario: ", what, &definition
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
class Riot::Context
|
22
|
+
include Melee::Context
|
23
|
+
end
|
24
|
+
|
25
|
+
# Monkey-patch the monkey patch to allow us to have feature anywhere
|
26
|
+
class Object
|
27
|
+
alias :feature :context
|
28
|
+
end
|
29
|
+
|
30
|
+
|
data/melee.gemspec
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "melee/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "melee"
|
7
|
+
s.version = Melee::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Arthur Chiu"]
|
10
|
+
s.email = ["mr.arthur.chiu@gmail.com"]
|
11
|
+
s.homepage = "http://thumblemonks.github.com/riot/"
|
12
|
+
s.summary = %q{Acceptance Test Solution for Riot}
|
13
|
+
s.description = %q{A Minimalist Acceptance Test Solution for Riot}
|
14
|
+
|
15
|
+
s.rubyforge_project = "melee"
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
s.add_dependency 'riot', '~>0.12.1'
|
22
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'riot'
|
3
|
+
require 'tempfile'
|
4
|
+
|
5
|
+
|
6
|
+
class Riot::Situation
|
7
|
+
|
8
|
+
def create_test(options)
|
9
|
+
options = {:content => options} unless options.is_a?(Hash)
|
10
|
+
temp_path = File.expand_path('../../../tmp',__FILE__)
|
11
|
+
path = (options[:path] || temp_path) + "/#{String.random}_test.rb"
|
12
|
+
File.open(path, "w") do |file|
|
13
|
+
file.write options[:content]
|
14
|
+
end
|
15
|
+
path
|
16
|
+
end
|
17
|
+
|
18
|
+
def run_test(file_path, app_base=Dir.pwd)
|
19
|
+
`ruby #{file_path}`
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
class String
|
25
|
+
def self.random
|
26
|
+
(0...8).map{65.+(rand(25)).chr}.join
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require File.expand_path('../acceptance_helper', __FILE__)
|
2
|
+
require File.expand_path('../../../lib/melee', __FILE__)
|
3
|
+
|
4
|
+
feature %Q{
|
5
|
+
In order to write better software
|
6
|
+
As a ruby developer
|
7
|
+
I want to execute acceptance tests in riot
|
8
|
+
} do
|
9
|
+
|
10
|
+
scenario "Minimal acceptance test that passes should give an output that" do
|
11
|
+
test_file = create_test <<-TEST
|
12
|
+
require File.expand_path('../../lib/melee',__FILE__)
|
13
|
+
feature "a minimal test" do
|
14
|
+
scenario("a scenario") { true }
|
15
|
+
end
|
16
|
+
TEST
|
17
|
+
run_test test_file
|
18
|
+
end.matches %r{1 passes, 0 failures}
|
19
|
+
|
20
|
+
scenario "Minimal acceptance test that fails should give an output that" do
|
21
|
+
test_file = create_test <<-TEST
|
22
|
+
require File.expand_path('../../lib/melee',__FILE__)
|
23
|
+
feature "a minimal test" do
|
24
|
+
scenario("a scenario") { false }
|
25
|
+
end
|
26
|
+
TEST
|
27
|
+
run_test test_file
|
28
|
+
end.matches %r{0 passes, 1 failures}
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
feature %{
|
33
|
+
In order for me to use melee
|
34
|
+
As a ruby developer and riot user
|
35
|
+
I need to be able to change some wording around
|
36
|
+
} do
|
37
|
+
|
38
|
+
scenario "Minimal acceptance test with a background should give an output that" do
|
39
|
+
test_file = create_test <<-TEST
|
40
|
+
require File.expand_path('../../lib/melee',__FILE__)
|
41
|
+
feature "a minimal test" do
|
42
|
+
background { @acceptance = true }
|
43
|
+
scenario("a scenario") { @acceptance }
|
44
|
+
end
|
45
|
+
TEST
|
46
|
+
run_test test_file
|
47
|
+
end.matches %r{1 passes, 0 failures}
|
48
|
+
|
49
|
+
scenario "Minimal acceptance test with a given should give an output that" do
|
50
|
+
test_file = create_test <<-TEST
|
51
|
+
require File.expand_path('../../lib/melee',__FILE__)
|
52
|
+
feature "a minimal test" do
|
53
|
+
given(:a_acceptance) { true }
|
54
|
+
scenario("a scenario") { a_acceptance }
|
55
|
+
end
|
56
|
+
TEST
|
57
|
+
run_test test_file
|
58
|
+
end.matches %r{1 passes, 0 failures}
|
59
|
+
|
60
|
+
end
|
61
|
+
|
metadata
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: melee
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.1
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Arthur Chiu
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-02-18 00:00:00 -08:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: riot
|
18
|
+
prerelease: false
|
19
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
21
|
+
requirements:
|
22
|
+
- - ~>
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 0.12.1
|
25
|
+
type: :runtime
|
26
|
+
version_requirements: *id001
|
27
|
+
description: A Minimalist Acceptance Test Solution for Riot
|
28
|
+
email:
|
29
|
+
- mr.arthur.chiu@gmail.com
|
30
|
+
executables: []
|
31
|
+
|
32
|
+
extensions: []
|
33
|
+
|
34
|
+
extra_rdoc_files: []
|
35
|
+
|
36
|
+
files:
|
37
|
+
- .gitignore
|
38
|
+
- Gemfile
|
39
|
+
- LICENSE
|
40
|
+
- README.md
|
41
|
+
- Rakefile
|
42
|
+
- lib/melee.rb
|
43
|
+
- lib/melee/version.rb
|
44
|
+
- melee.gemspec
|
45
|
+
- test/acceptance/acceptance_helper.rb
|
46
|
+
- test/acceptance/basic_test.rb
|
47
|
+
has_rdoc: true
|
48
|
+
homepage: http://thumblemonks.github.com/riot/
|
49
|
+
licenses: []
|
50
|
+
|
51
|
+
post_install_message:
|
52
|
+
rdoc_options: []
|
53
|
+
|
54
|
+
require_paths:
|
55
|
+
- lib
|
56
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: "0"
|
62
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
63
|
+
none: false
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: "0"
|
68
|
+
requirements: []
|
69
|
+
|
70
|
+
rubyforge_project: melee
|
71
|
+
rubygems_version: 1.5.2
|
72
|
+
signing_key:
|
73
|
+
specification_version: 3
|
74
|
+
summary: Acceptance Test Solution for Riot
|
75
|
+
test_files:
|
76
|
+
- test/acceptance/acceptance_helper.rb
|
77
|
+
- test/acceptance/basic_test.rb
|