remarkable 3.1.13 → 4.0.0.alpha1

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -39,27 +39,6 @@ And it will show in your specs output:
39
39
 
40
40
  "Example disabled: require name to be set"
41
41
 
42
- == Pending macros
43
-
44
- In Rspec you can mark some examples as pending:
45
-
46
- it "should have one manager" do
47
- pending("create managers resource")
48
- end
49
-
50
- it "should validate associated manager" do
51
- pending("create managers resource")
52
- end
53
-
54
- To allow this to work with macros, we created the pending group:
55
-
56
- pending "create managers resource" do
57
- should_have_one :manager
58
- should_validate_associated :manager
59
- end
60
-
61
- This outputs the same as above.
62
-
63
42
  == I18n
64
43
 
65
44
  All matchers come with I18n support. You can find an example locale file under
@@ -85,9 +64,9 @@ Create a new matcher is easy. Let's create validate_inclusion_of matcher for
85
64
  ActiveRecord as an example. A first matcher version would be:
86
65
 
87
66
  module Remarkable
88
- module ActiveRecord
67
+ module ActiveModel
89
68
  module Matchers
90
- class ValidateInclusionOfMatcher < Remarkable::ActiveRecord::Base
69
+ class ValidateInclusionOfMatcher < Remarkable::ActiveModel::Base
91
70
  arguments :attribute
92
71
  assertion :is_valid?
93
72
 
@@ -131,7 +110,7 @@ As you noticed, the matcher doesn't have any message on it. You add them on I18n
131
110
  file. A file for this example would be:
132
111
 
133
112
  remarkable:
134
- active_record:
113
+ active_model:
135
114
  validate_inclusion_of:
136
115
  description: "validate inclusion of {{attribute}}"
137
116
  expectations:
@@ -8,11 +8,11 @@ require File.join(dir, 'remarkable', 'messages')
8
8
 
9
9
  require File.join(dir, 'remarkable', 'base')
10
10
  require File.join(dir, 'remarkable', 'macros')
11
- require File.join(dir, 'remarkable', 'pending')
11
+ #require File.join(dir, 'remarkable', 'pending')
12
12
  require File.join(dir, 'remarkable', 'negative')
13
13
  require File.join(dir, 'remarkable', 'core_ext', 'array')
14
14
 
15
- if defined?(Spec)
15
+ if defined?(Rspec)
16
16
  require File.join(dir, 'remarkable', 'rspec')
17
17
  end
18
18
 
@@ -12,14 +12,13 @@ module Remarkable
12
12
  def self.include_matchers!(base, target=nil)
13
13
  if target.nil?
14
14
  if rspec_defined?
15
- target = Spec::Example::ExampleGroup
15
+ target = Rspec::Matchers
16
16
  else
17
- raise ArgumentError, "You haven't supplied the target to include_matchers! and RSpec is not loaded, so we cannot infer one."
17
+ raise ArgumentError, "You haven't supplied the target to include_matchers! and Rspec is not loaded, so we cannot infer one."
18
18
  end
19
19
  end
20
20
 
21
21
  metaclass = (class << target; self; end)
22
- target.send :extend, Remarkable::Pending unless metaclass.ancestors.include?(Remarkable::Pending)
23
22
  target.send :extend, Remarkable::Macros unless metaclass.ancestors.include?(Remarkable::Macros)
24
23
 
25
24
  if defined?(base::Matchers)
@@ -35,6 +34,6 @@ module Remarkable
35
34
  end
36
35
 
37
36
  def self.rspec_defined? #:nodoc:
38
- defined?(Spec)
37
+ defined?(Rspec)
39
38
  end
40
39
  end
@@ -1,4 +1,4 @@
1
- module Spec #:nodoc:
1
+ module Rspec #:nodoc:
2
2
  module Matchers #:nodoc:
3
3
  # Overwrites to provide I18n on should and should_not.
4
4
  #
@@ -9,16 +9,23 @@ module Spec #:nodoc:
9
9
  end
10
10
  end
11
11
 
12
- module Example #:nodoc:
13
- module ExampleGroupMethods #:nodoc:
12
+ module Core #:nodoc:
13
+ class ExampleGroup #:nodoc:
14
14
  # Overwrites to provide I18n on example disabled message.
15
15
  #
16
- def xexample(description=nil, opts={}, &block)
16
+ def _xexample(description=nil, opts={}, &block)
17
17
  disabled = Remarkable.t 'remarkable.core.example_disabled', :default => 'Example disabled'
18
18
  Kernel.warn("#{disabled}: #{description}")
19
19
  end
20
- alias_method :xit, :xexample
21
- alias_method :xspecify, :xexample
20
+ #alias_method :xit, :xexample
21
+ #alias_method :xspecify, :xexample
22
+
23
+ # NOTE: Hack. Disabled examples is not the same as pending examples
24
+ # However, the rspec runner is monolithic and doesn't have a hook to process
25
+ # examples based on metadata
26
+ alias_example_to :xexample, :disabled => true, :pending => true
27
+ alias_example_to :xit, :disabled => true, :pending => true
28
+ alias_example_to :xspecify, :disabled => true, :pending => true
22
29
  end
23
30
  end
24
31
  end
@@ -1,3 +1,3 @@
1
1
  module Remarkable
2
- VERSION = '3.1.13' unless self.const_defined?(:VERSION)
2
+ VERSION = '4.0.0.alpha1' unless self.const_defined?(:VERSION)
3
3
  end
@@ -1,32 +1,61 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
1
4
  # -*- encoding: utf-8 -*-
2
5
 
3
6
  Gem::Specification.new do |s|
4
7
  s.name = %q{remarkable}
5
- s.version = "3.1.13"
8
+ s.version = "4.0.0.alpha1"
6
9
 
7
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
- s.authors = ["Carlos Brando", "Jos\303\251 Valim"]
9
- s.date = %q{2010-02-19}
10
- s.description = %q{Remarkable: a framework for rspec matchers, with support to macros and I18n.}
11
- s.email = ["eduardobrando@gmail.com", "jose.valim@gmail.com"]
12
- s.extra_rdoc_files = ["README", "LICENSE", "CHANGELOG"]
13
- s.files = ["README", "LICENSE", "CHANGELOG", "lib/remarkable", "lib/remarkable/base.rb", "lib/remarkable/core_ext", "lib/remarkable/core_ext/array.rb", "lib/remarkable/dsl", "lib/remarkable/dsl/assertions.rb", "lib/remarkable/dsl/callbacks.rb", "lib/remarkable/dsl/optionals.rb", "lib/remarkable/dsl.rb", "lib/remarkable/i18n.rb", "lib/remarkable/macros.rb", "lib/remarkable/matchers.rb", "lib/remarkable/messages.rb", "lib/remarkable/negative.rb", "lib/remarkable/pending.rb", "lib/remarkable/rspec.rb", "lib/remarkable/version.rb", "lib/remarkable.rb", "locale/en.yml", "remarkable.gemspec"]
10
+ s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Ho-Sheng Hsiao", "Carlos Brando", "Jos\303\251 Valim"]
12
+ s.date = %q{2010-04-22}
13
+ s.description = %q{Remarkable: a framework for rspec matchers and macros, with support for I18n.}
14
+ s.email = ["hosh@sparkfly.com", "eduardobrando@gmail.com", "jose.valim@gmail.com"]
15
+ s.extra_rdoc_files = [
16
+ "CHANGELOG",
17
+ "LICENSE",
18
+ "README"
19
+ ]
20
+ s.files = [
21
+ "CHANGELOG",
22
+ "LICENSE",
23
+ "README",
24
+ "lib/remarkable.rb",
25
+ "lib/remarkable/base.rb",
26
+ "lib/remarkable/core_ext/array.rb",
27
+ "lib/remarkable/dsl.rb",
28
+ "lib/remarkable/dsl/assertions.rb",
29
+ "lib/remarkable/dsl/callbacks.rb",
30
+ "lib/remarkable/dsl/optionals.rb",
31
+ "lib/remarkable/i18n.rb",
32
+ "lib/remarkable/macros.rb",
33
+ "lib/remarkable/matchers.rb",
34
+ "lib/remarkable/messages.rb",
35
+ "lib/remarkable/negative.rb",
36
+ "lib/remarkable/rspec.rb",
37
+ "lib/remarkable/version.rb",
38
+ "locale/en.yml",
39
+ "remarkable.gemspec"
40
+ ]
14
41
  s.homepage = %q{http://github.com/carlosbrando/remarkable}
42
+ s.rdoc_options = ["--charset=UTF-8"]
15
43
  s.require_paths = ["lib"]
16
44
  s.rubyforge_project = %q{remarkable}
17
- s.rubygems_version = %q{1.3.5}
18
- s.summary = %q{Remarkable: a framework for rspec matchers, with support to macros and I18n.}
45
+ s.rubygems_version = %q{1.3.6}
46
+ s.summary = %q{Remarkable: a framework for rspec matchers and macros, with support for I18n.}
19
47
 
20
48
  if s.respond_to? :specification_version then
21
49
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
22
50
  s.specification_version = 3
23
51
 
24
52
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
25
- s.add_runtime_dependency(%q<rspec>, [">= 1.2.0"])
53
+ s.add_runtime_dependency(%q<rspec>, [">= 2.0.0.alpha7"])
26
54
  else
27
- s.add_dependency(%q<rspec>, [">= 1.2.0"])
55
+ s.add_dependency(%q<rspec>, [">= 2.0.0.alpha7"])
28
56
  end
29
57
  else
30
- s.add_dependency(%q<rspec>, [">= 1.2.0"])
58
+ s.add_dependency(%q<rspec>, [">= 2.0.0.alpha7"])
31
59
  end
32
60
  end
61
+
metadata CHANGED
@@ -1,30 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: remarkable
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.13
4
+ prerelease: true
5
+ segments:
6
+ - 4
7
+ - 0
8
+ - 0
9
+ - alpha1
10
+ version: 4.0.0.alpha1
5
11
  platform: ruby
6
12
  authors:
13
+ - Ho-Sheng Hsiao
7
14
  - Carlos Brando
8
15
  - "Jos\xC3\xA9 Valim"
9
16
  autorequire:
10
17
  bindir: bin
11
18
  cert_chain: []
12
19
 
13
- date: 2010-02-19 00:00:00 +01:00
20
+ date: 2010-04-22 00:00:00 -04:00
14
21
  default_executable:
15
22
  dependencies:
16
23
  - !ruby/object:Gem::Dependency
17
24
  name: rspec
18
- type: :runtime
19
- version_requirement:
20
- version_requirements: !ruby/object:Gem::Requirement
25
+ prerelease: false
26
+ requirement: &id001 !ruby/object:Gem::Requirement
21
27
  requirements:
22
28
  - - ">="
23
29
  - !ruby/object:Gem::Version
24
- version: 1.2.0
25
- version:
26
- description: "Remarkable: a framework for rspec matchers, with support to macros and I18n."
30
+ segments:
31
+ - 2
32
+ - 0
33
+ - 0
34
+ - alpha7
35
+ version: 2.0.0.alpha7
36
+ type: :runtime
37
+ version_requirements: *id001
38
+ description: "Remarkable: a framework for rspec matchers and macros, with support for I18n."
27
39
  email:
40
+ - hosh@sparkfly.com
28
41
  - eduardobrando@gmail.com
29
42
  - jose.valim@gmail.com
30
43
  executables: []
@@ -32,28 +45,27 @@ executables: []
32
45
  extensions: []
33
46
 
34
47
  extra_rdoc_files:
35
- - README
36
- - LICENSE
37
48
  - CHANGELOG
38
- files:
39
- - README
40
49
  - LICENSE
50
+ - README
51
+ files:
41
52
  - CHANGELOG
53
+ - LICENSE
54
+ - README
55
+ - lib/remarkable.rb
42
56
  - lib/remarkable/base.rb
43
57
  - lib/remarkable/core_ext/array.rb
58
+ - lib/remarkable/dsl.rb
44
59
  - lib/remarkable/dsl/assertions.rb
45
60
  - lib/remarkable/dsl/callbacks.rb
46
61
  - lib/remarkable/dsl/optionals.rb
47
- - lib/remarkable/dsl.rb
48
62
  - lib/remarkable/i18n.rb
49
63
  - lib/remarkable/macros.rb
50
64
  - lib/remarkable/matchers.rb
51
65
  - lib/remarkable/messages.rb
52
66
  - lib/remarkable/negative.rb
53
- - lib/remarkable/pending.rb
54
67
  - lib/remarkable/rspec.rb
55
68
  - lib/remarkable/version.rb
56
- - lib/remarkable.rb
57
69
  - locale/en.yml
58
70
  - remarkable.gemspec
59
71
  has_rdoc: true
@@ -61,28 +73,32 @@ homepage: http://github.com/carlosbrando/remarkable
61
73
  licenses: []
62
74
 
63
75
  post_install_message:
64
- rdoc_options: []
65
-
76
+ rdoc_options:
77
+ - --charset=UTF-8
66
78
  require_paths:
67
79
  - lib
68
80
  required_ruby_version: !ruby/object:Gem::Requirement
69
81
  requirements:
70
82
  - - ">="
71
83
  - !ruby/object:Gem::Version
84
+ segments:
85
+ - 0
72
86
  version: "0"
73
- version:
74
87
  required_rubygems_version: !ruby/object:Gem::Requirement
75
88
  requirements:
76
- - - ">="
89
+ - - ">"
77
90
  - !ruby/object:Gem::Version
78
- version: "0"
79
- version:
91
+ segments:
92
+ - 1
93
+ - 3
94
+ - 1
95
+ version: 1.3.1
80
96
  requirements: []
81
97
 
82
98
  rubyforge_project: remarkable
83
- rubygems_version: 1.3.5
99
+ rubygems_version: 1.3.6
84
100
  signing_key:
85
101
  specification_version: 3
86
- summary: "Remarkable: a framework for rspec matchers, with support to macros and I18n."
102
+ summary: "Remarkable: a framework for rspec matchers and macros, with support for I18n."
87
103
  test_files: []
88
104
 
@@ -1,68 +0,0 @@
1
- module Remarkable
2
-
3
- module Pending
4
-
5
- # We cannot put the alias method in the module because it's a Ruby 1.8 bug
6
- # http://coderrr.wordpress.com/2008/03/28/alias_methodmodule-bug-in-ruby-18/
7
- #
8
- def self.extended(base) #:nodoc:
9
- if base.respond_to?(:example)
10
- class << base
11
- alias_method :example_without_pending, :example
12
- alias_method :example, :example_with_pending
13
- alias :it :example
14
- alias :specify :example
15
- end
16
- end
17
- end
18
-
19
- # Adds a pending block to your specs.
20
- #
21
- # == Examples
22
- #
23
- # pending 'create manager resource' do
24
- # should_have_one :manager
25
- # should_validate_associated :manager
26
- # end
27
- #
28
- # By default, it executes the examples inside the pending block. So as soon
29
- # as you add the has_one :manager relationship to your model, your specs
30
- # will say that this was already fixed and there is no need to be treated
31
- # as pending. To disable this behavior, you can give :execute => false:
32
- #
33
- # pending 'create manager resource', :execute => false
34
- #
35
- def pending(*args, &block)
36
- options = { :execute => true }.merge(args.extract_options!)
37
-
38
- @_pending_group = true
39
- @_pending_group_description = args.first || "TODO"
40
- @_pending_group_execute = options.delete(:execute)
41
-
42
- self.instance_eval(&block)
43
-
44
- @_pending_group = false
45
- @_pending_group_description = nil
46
- @_pending_group_execute = nil
47
- end
48
-
49
- def example_with_pending(description=nil, options={}, backtrace=nil, &implementation) #:nodoc:
50
- if block_given? && @_pending_group
51
- pending_caller = caller.detect{ |c| c !~ /method_missing'/ }
52
- pending_description = @_pending_group_description
53
-
54
- pending_block = if @_pending_group_execute
55
- proc{ pending(pending_description){ self.instance_eval(&implementation) } }
56
- else
57
- proc{ pending(pending_description) }
58
- end
59
-
60
- example_without_pending(description, options, backtrace || pending_caller, &pending_block)
61
- else
62
- example_without_pending(description, options, backtrace || caller(0)[1], &implementation)
63
- end
64
- end
65
-
66
- end
67
-
68
- end