scaffolder-test-helpers 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +4 -0
- data/.rspec +1 -0
- data/Gemfile +14 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +19 -0
- data/Rakefile +32 -0
- data/VERSION +1 -0
- data/lib/scaffolder/test/cucumber_steps.rb +24 -0
- data/lib/scaffolder/test/helpers.rb +37 -0
- data/scaffolder-test-helpers.gemspec +74 -0
- data/spec/scaffolder/test/helpers_spec.rb +14 -0
- data/spec/spec_helper.rb +12 -0
- metadata +184 -0
data/.document
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/Gemfile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
group :default do
|
4
|
+
gem "bio", "~> 1.4"
|
5
|
+
gem "scaffolder", "~> 0.4"
|
6
|
+
gem "cucumber", "~> 0.9"
|
7
|
+
end
|
8
|
+
|
9
|
+
group :development do
|
10
|
+
gem "bundler", "~> 1.0"
|
11
|
+
gem "jeweler", "~> 1.5"
|
12
|
+
gem "rspec", "~> 2.2"
|
13
|
+
gem "yard", "~> 0.6"
|
14
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010 Michael Barton
|
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.
|
data/README.rdoc
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
= scaffolder-test-helpers
|
2
|
+
|
3
|
+
Description goes here.
|
4
|
+
|
5
|
+
== Contributing to scaffolder-test-helpers
|
6
|
+
|
7
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
8
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
9
|
+
* Fork the project
|
10
|
+
* Start a feature/bugfix branch
|
11
|
+
* Commit and push until you are happy with your contribution
|
12
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
13
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
14
|
+
|
15
|
+
== Copyright
|
16
|
+
|
17
|
+
Copyright (c) 2010 Michael Barton. See LICENSE.txt for
|
18
|
+
further details.
|
19
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
require 'rake'
|
11
|
+
|
12
|
+
require 'rspec/core'
|
13
|
+
require 'rspec/core/rake_task'
|
14
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
15
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
16
|
+
end
|
17
|
+
|
18
|
+
require 'jeweler'
|
19
|
+
Jeweler::Tasks.new do |gem|
|
20
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
21
|
+
gem.name = "scaffolder-test-helpers"
|
22
|
+
gem.homepage = "http://github.com/michaelbarton/scaffolder-test-helpers"
|
23
|
+
gem.license = "MIT"
|
24
|
+
gem.summary = %Q{Common methods for testing scaffolder.}
|
25
|
+
gem.description = %Q{Helper methods and cucumber steps for testing scaffolder.}
|
26
|
+
gem.email = "mail@michaelbarton.me.uk"
|
27
|
+
gem.authors = ["Michael Barton"]
|
28
|
+
end
|
29
|
+
Jeweler::RubygemsDotOrgTasks.new
|
30
|
+
|
31
|
+
require 'yard'
|
32
|
+
YARD::Rake::YardocTask.new
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'scaffolder/test/helpers'
|
2
|
+
require 'cucumber'
|
3
|
+
|
4
|
+
World(Scaffolder::Test::Helpers)
|
5
|
+
|
6
|
+
Given /^the scaffold is composed of the sequences:$/ do |sequences|
|
7
|
+
@entries = sequences.hashes.map do |seq|
|
8
|
+
{'sequence' => {'source' => seq['name']}}
|
9
|
+
end
|
10
|
+
@sequences = sequences.hashes.map do |seq|
|
11
|
+
{:name => seq['name'], :sequence => seq['nucleotides']}
|
12
|
+
end
|
13
|
+
|
14
|
+
@sequence_file = write_sequence_file(@sequences)
|
15
|
+
@scaffold_file = write_scaffold_file(@entries)
|
16
|
+
end
|
17
|
+
|
18
|
+
Given /^the scaffold file is called "([^"]*)"$/ do |file|
|
19
|
+
FileUtils.mv(@scaffold_file,file)
|
20
|
+
end
|
21
|
+
|
22
|
+
Given /^the sequence file is called "([^"]*)"$/ do |file|
|
23
|
+
FileUtils.mv(@sequence_file,file)
|
24
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'tempfile'
|
2
|
+
require 'bio'
|
3
|
+
require 'scaffolder'
|
4
|
+
|
5
|
+
module Scaffolder::Test
|
6
|
+
module Helpers
|
7
|
+
|
8
|
+
def write_sequence_file(entries,file = Tempfile.new("sequence").path)
|
9
|
+
File.open(file,'w') do |tmp|
|
10
|
+
make_sequence(entries).each do |entry|
|
11
|
+
seq = Bio::Sequence.new(entry[:sequence])
|
12
|
+
tmp.print(seq.output(:fasta,:header => entry[:name]))
|
13
|
+
end
|
14
|
+
end
|
15
|
+
file
|
16
|
+
end
|
17
|
+
|
18
|
+
def write_scaffold_file(entries,file = Tempfile.new("scaffold").path)
|
19
|
+
File.open(file,'w'){|tmp| tmp.print(YAML.dump(make_scaffold(entries)))}
|
20
|
+
file
|
21
|
+
end
|
22
|
+
|
23
|
+
def make_scaffold(entries)
|
24
|
+
entries.map do |entry|
|
25
|
+
{'sequence' => {'source' => (entry['name'] || entry[:name]) }}
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def make_sequence(entries)
|
30
|
+
entries.map do |entry|
|
31
|
+
{:name => (entry['name'] || entry[:name]),
|
32
|
+
:sequence => (entry['nucleotides'] || entry[:nucleotides]) }
|
33
|
+
end.flatten
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{scaffolder-test-helpers}
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Michael Barton"]
|
12
|
+
s.date = %q{2011-01-04}
|
13
|
+
s.description = %q{Helper methods and cucumber steps for testing scaffolder.}
|
14
|
+
s.email = %q{mail@michaelbarton.me.uk}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".rspec",
|
22
|
+
"Gemfile",
|
23
|
+
"LICENSE.txt",
|
24
|
+
"README.rdoc",
|
25
|
+
"Rakefile",
|
26
|
+
"VERSION",
|
27
|
+
"lib/scaffolder/test/cucumber_steps.rb",
|
28
|
+
"lib/scaffolder/test/helpers.rb",
|
29
|
+
"scaffolder-test-helpers.gemspec",
|
30
|
+
"spec/scaffolder/test/helpers_spec.rb",
|
31
|
+
"spec/spec_helper.rb"
|
32
|
+
]
|
33
|
+
s.homepage = %q{http://github.com/michaelbarton/scaffolder-test-helpers}
|
34
|
+
s.licenses = ["MIT"]
|
35
|
+
s.require_paths = ["lib"]
|
36
|
+
s.rubygems_version = %q{1.3.7}
|
37
|
+
s.summary = %q{Common methods for testing scaffolder.}
|
38
|
+
s.test_files = [
|
39
|
+
"spec/scaffolder/test/helpers_spec.rb",
|
40
|
+
"spec/spec_helper.rb"
|
41
|
+
]
|
42
|
+
|
43
|
+
if s.respond_to? :specification_version then
|
44
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
45
|
+
s.specification_version = 3
|
46
|
+
|
47
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
48
|
+
s.add_runtime_dependency(%q<bio>, ["~> 1.4"])
|
49
|
+
s.add_runtime_dependency(%q<scaffolder>, ["~> 0.4"])
|
50
|
+
s.add_runtime_dependency(%q<cucumber>, ["~> 0.9"])
|
51
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0"])
|
52
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.5"])
|
53
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.2"])
|
54
|
+
s.add_development_dependency(%q<yard>, ["~> 0.6"])
|
55
|
+
else
|
56
|
+
s.add_dependency(%q<bio>, ["~> 1.4"])
|
57
|
+
s.add_dependency(%q<scaffolder>, ["~> 0.4"])
|
58
|
+
s.add_dependency(%q<cucumber>, ["~> 0.9"])
|
59
|
+
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
60
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5"])
|
61
|
+
s.add_dependency(%q<rspec>, ["~> 2.2"])
|
62
|
+
s.add_dependency(%q<yard>, ["~> 0.6"])
|
63
|
+
end
|
64
|
+
else
|
65
|
+
s.add_dependency(%q<bio>, ["~> 1.4"])
|
66
|
+
s.add_dependency(%q<scaffolder>, ["~> 0.4"])
|
67
|
+
s.add_dependency(%q<cucumber>, ["~> 0.9"])
|
68
|
+
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
69
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5"])
|
70
|
+
s.add_dependency(%q<rspec>, ["~> 2.2"])
|
71
|
+
s.add_dependency(%q<yard>, ["~> 0.6"])
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__),'..','..','spec_helper')
|
2
|
+
|
3
|
+
describe Scaffolder::Test::Helpers do
|
4
|
+
|
5
|
+
it{ described_class.class.should == Module }
|
6
|
+
|
7
|
+
describe "namespace loading" do
|
8
|
+
|
9
|
+
it{ Scaffolder.class.should == Class }
|
10
|
+
it{ Scaffolder.methods.should include("update_with_sequence") }
|
11
|
+
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
+
require 'rspec'
|
4
|
+
|
5
|
+
require 'scaffolder/test/helpers'
|
6
|
+
|
7
|
+
# Requires supporting files with custom matchers and macros, etc,
|
8
|
+
# in ./support/ and its subdirectories.
|
9
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
10
|
+
|
11
|
+
RSpec.configure do |config|
|
12
|
+
end
|
metadata
ADDED
@@ -0,0 +1,184 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: scaffolder-test-helpers
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Michael Barton
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-01-04 00:00:00 -05:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
23
|
+
none: false
|
24
|
+
requirements:
|
25
|
+
- - ~>
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
hash: 7
|
28
|
+
segments:
|
29
|
+
- 1
|
30
|
+
- 4
|
31
|
+
version: "1.4"
|
32
|
+
type: :runtime
|
33
|
+
name: bio
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *id001
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
+
none: false
|
39
|
+
requirements:
|
40
|
+
- - ~>
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
hash: 3
|
43
|
+
segments:
|
44
|
+
- 0
|
45
|
+
- 4
|
46
|
+
version: "0.4"
|
47
|
+
type: :runtime
|
48
|
+
name: scaffolder
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: *id002
|
51
|
+
- !ruby/object:Gem::Dependency
|
52
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ~>
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
hash: 25
|
58
|
+
segments:
|
59
|
+
- 0
|
60
|
+
- 9
|
61
|
+
version: "0.9"
|
62
|
+
type: :runtime
|
63
|
+
name: cucumber
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: *id003
|
66
|
+
- !ruby/object:Gem::Dependency
|
67
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
68
|
+
none: false
|
69
|
+
requirements:
|
70
|
+
- - ~>
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
hash: 15
|
73
|
+
segments:
|
74
|
+
- 1
|
75
|
+
- 0
|
76
|
+
version: "1.0"
|
77
|
+
type: :development
|
78
|
+
name: bundler
|
79
|
+
prerelease: false
|
80
|
+
version_requirements: *id004
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ~>
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
hash: 5
|
88
|
+
segments:
|
89
|
+
- 1
|
90
|
+
- 5
|
91
|
+
version: "1.5"
|
92
|
+
type: :development
|
93
|
+
name: jeweler
|
94
|
+
prerelease: false
|
95
|
+
version_requirements: *id005
|
96
|
+
- !ruby/object:Gem::Dependency
|
97
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
98
|
+
none: false
|
99
|
+
requirements:
|
100
|
+
- - ~>
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
hash: 7
|
103
|
+
segments:
|
104
|
+
- 2
|
105
|
+
- 2
|
106
|
+
version: "2.2"
|
107
|
+
type: :development
|
108
|
+
name: rspec
|
109
|
+
prerelease: false
|
110
|
+
version_requirements: *id006
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ~>
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
hash: 7
|
118
|
+
segments:
|
119
|
+
- 0
|
120
|
+
- 6
|
121
|
+
version: "0.6"
|
122
|
+
type: :development
|
123
|
+
name: yard
|
124
|
+
prerelease: false
|
125
|
+
version_requirements: *id007
|
126
|
+
description: Helper methods and cucumber steps for testing scaffolder.
|
127
|
+
email: mail@michaelbarton.me.uk
|
128
|
+
executables: []
|
129
|
+
|
130
|
+
extensions: []
|
131
|
+
|
132
|
+
extra_rdoc_files:
|
133
|
+
- LICENSE.txt
|
134
|
+
- README.rdoc
|
135
|
+
files:
|
136
|
+
- .document
|
137
|
+
- .rspec
|
138
|
+
- Gemfile
|
139
|
+
- LICENSE.txt
|
140
|
+
- README.rdoc
|
141
|
+
- Rakefile
|
142
|
+
- VERSION
|
143
|
+
- lib/scaffolder/test/cucumber_steps.rb
|
144
|
+
- lib/scaffolder/test/helpers.rb
|
145
|
+
- scaffolder-test-helpers.gemspec
|
146
|
+
- spec/scaffolder/test/helpers_spec.rb
|
147
|
+
- spec/spec_helper.rb
|
148
|
+
has_rdoc: true
|
149
|
+
homepage: http://github.com/michaelbarton/scaffolder-test-helpers
|
150
|
+
licenses:
|
151
|
+
- MIT
|
152
|
+
post_install_message:
|
153
|
+
rdoc_options: []
|
154
|
+
|
155
|
+
require_paths:
|
156
|
+
- lib
|
157
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
158
|
+
none: false
|
159
|
+
requirements:
|
160
|
+
- - ">="
|
161
|
+
- !ruby/object:Gem::Version
|
162
|
+
hash: 3
|
163
|
+
segments:
|
164
|
+
- 0
|
165
|
+
version: "0"
|
166
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
167
|
+
none: false
|
168
|
+
requirements:
|
169
|
+
- - ">="
|
170
|
+
- !ruby/object:Gem::Version
|
171
|
+
hash: 3
|
172
|
+
segments:
|
173
|
+
- 0
|
174
|
+
version: "0"
|
175
|
+
requirements: []
|
176
|
+
|
177
|
+
rubyforge_project:
|
178
|
+
rubygems_version: 1.3.7
|
179
|
+
signing_key:
|
180
|
+
specification_version: 3
|
181
|
+
summary: Common methods for testing scaffolder.
|
182
|
+
test_files:
|
183
|
+
- spec/scaffolder/test/helpers_spec.rb
|
184
|
+
- spec/spec_helper.rb
|