rspec_more 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +2 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +30 -0
- data/Manifest +9 -0
- data/README.md +24 -0
- data/Rakefile +9 -0
- data/lib/rspec_more/data_mapper.rb +13 -0
- data/lib/rspec_more.rb +15 -0
- data/rspec_more.gemspec +29 -0
- metadata +70 -0
data/CHANGELOG
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
allison (2.0.3)
|
5
|
+
diff-lcs (1.1.2)
|
6
|
+
echoe (4.5.5)
|
7
|
+
allison
|
8
|
+
gemcutter
|
9
|
+
rubyforge
|
10
|
+
gemcutter (0.7.0)
|
11
|
+
json_pure (1.5.1)
|
12
|
+
rake (0.8.7)
|
13
|
+
rspec (2.5.0)
|
14
|
+
rspec-core (~> 2.5.0)
|
15
|
+
rspec-expectations (~> 2.5.0)
|
16
|
+
rspec-mocks (~> 2.5.0)
|
17
|
+
rspec-core (2.5.1)
|
18
|
+
rspec-expectations (2.5.0)
|
19
|
+
diff-lcs (~> 1.1.2)
|
20
|
+
rspec-mocks (2.5.0)
|
21
|
+
rubyforge (2.0.4)
|
22
|
+
json_pure (>= 1.1.7)
|
23
|
+
|
24
|
+
PLATFORMS
|
25
|
+
ruby
|
26
|
+
|
27
|
+
DEPENDENCIES
|
28
|
+
echoe
|
29
|
+
rake
|
30
|
+
rspec
|
data/Manifest
ADDED
data/README.md
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
rspec_more -- provides some rpsec matcher and macros
|
2
|
+
====================================
|
3
|
+
|
4
|
+
## DESCRIPTION
|
5
|
+
This gem is intending to provide more macros and matchers for rspec
|
6
|
+
The current supported macros:
|
7
|
+
* reequire_attribute attr
|
8
|
+
|
9
|
+
This macro does validation for a model and currently only works for DataMapper
|
10
|
+
an example usage:
|
11
|
+
|
12
|
+
describe User do
|
13
|
+
describe "validations" do
|
14
|
+
require_attribute :name
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
## INSTALL
|
19
|
+
|
20
|
+
$ [sudo] gem install rspec_more
|
21
|
+
|
22
|
+
Then in the spec_helper.rb, add:
|
23
|
+
|
24
|
+
config.extend(RspecMore::DataMapper, :type => :model)
|
data/Rakefile
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
require 'echoe'
|
2
|
+
Echoe.new('rspec_more') do |p|
|
3
|
+
p.description = "A Rspec extension for more macros and matchers, etc."
|
4
|
+
p.author = "Yi Wen"
|
5
|
+
p.email = "hayafirst@gmail.com"
|
6
|
+
p.ignore_pattern = ["bin/*"]
|
7
|
+
p.url = "https://github.com/ywen/rspec_more"
|
8
|
+
# p.development_dependencies = []
|
9
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module RspecMore
|
2
|
+
module DataMapper
|
3
|
+
def require_attribute(field)
|
4
|
+
it "require #{field.inspect}" do
|
5
|
+
object_name = self.described_class.to_s.demodulize.underscore
|
6
|
+
object = send(object_name)
|
7
|
+
object.send("#{field}=", nil)
|
8
|
+
object.should_not be_valid
|
9
|
+
object.errors.should have_key(field.to_sym)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/lib/rspec_more.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rspec'
|
3
|
+
require 'rspec-rails'
|
4
|
+
def require_all_files_under(directory)
|
5
|
+
Dir.open(directory) do |dir|
|
6
|
+
dir.entries.each do |file_name|
|
7
|
+
file = "#{dir.path}/#{file_name}"
|
8
|
+
require "#{dir.path}/#{file_name.gsub(/\.rb/, '')}" if file_name =~ /\.rb$/
|
9
|
+
require_all_files_under(file) if File.directory?(file) && file_name != "." && file_name != ".."
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
current_dir = "#{File.expand_path(File.dirname(__FILE__))}/rspec_more"
|
14
|
+
require_all_files_under(current_dir)
|
15
|
+
|
data/rspec_more.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{rspec_more}
|
5
|
+
s.version = "0.1.1"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Yi Wen"]
|
9
|
+
s.date = %q{2011-04-15}
|
10
|
+
s.description = %q{A Rspec extension for more macros and matchers, etc.}
|
11
|
+
s.email = %q{hayafirst@gmail.com}
|
12
|
+
s.extra_rdoc_files = ["CHANGELOG", "README.md", "lib/rspec_more.rb", "lib/rspec_more/data_mapper.rb"]
|
13
|
+
s.files = ["CHANGELOG", "Gemfile", "Gemfile.lock", "Manifest", "README.md", "Rakefile", "lib/rspec_more.rb", "lib/rspec_more/data_mapper.rb", "rspec_more.gemspec"]
|
14
|
+
s.homepage = %q{https://github.com/ywen/rspec_more}
|
15
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Rspec_more", "--main", "README.md"]
|
16
|
+
s.require_paths = ["lib"]
|
17
|
+
s.rubyforge_project = %q{rspec_more}
|
18
|
+
s.rubygems_version = %q{1.7.2}
|
19
|
+
s.summary = %q{A Rspec extension for more macros and matchers, etc.}
|
20
|
+
|
21
|
+
if s.respond_to? :specification_version then
|
22
|
+
s.specification_version = 3
|
23
|
+
|
24
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
25
|
+
else
|
26
|
+
end
|
27
|
+
else
|
28
|
+
end
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rspec_more
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.1.1
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Yi Wen
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-04-15 00:00:00 Z
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: A Rspec extension for more macros and matchers, etc.
|
17
|
+
email: hayafirst@gmail.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- CHANGELOG
|
24
|
+
- README.md
|
25
|
+
- lib/rspec_more.rb
|
26
|
+
- lib/rspec_more/data_mapper.rb
|
27
|
+
files:
|
28
|
+
- CHANGELOG
|
29
|
+
- Gemfile
|
30
|
+
- Gemfile.lock
|
31
|
+
- Manifest
|
32
|
+
- README.md
|
33
|
+
- Rakefile
|
34
|
+
- lib/rspec_more.rb
|
35
|
+
- lib/rspec_more/data_mapper.rb
|
36
|
+
- rspec_more.gemspec
|
37
|
+
homepage: https://github.com/ywen/rspec_more
|
38
|
+
licenses: []
|
39
|
+
|
40
|
+
post_install_message:
|
41
|
+
rdoc_options:
|
42
|
+
- --line-numbers
|
43
|
+
- --inline-source
|
44
|
+
- --title
|
45
|
+
- Rspec_more
|
46
|
+
- --main
|
47
|
+
- README.md
|
48
|
+
require_paths:
|
49
|
+
- lib
|
50
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: "0"
|
56
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: "1.2"
|
62
|
+
requirements: []
|
63
|
+
|
64
|
+
rubyforge_project: rspec_more
|
65
|
+
rubygems_version: 1.7.2
|
66
|
+
signing_key:
|
67
|
+
specification_version: 3
|
68
|
+
summary: A Rspec extension for more macros and matchers, etc.
|
69
|
+
test_files: []
|
70
|
+
|