rspec-its 1.0.0.pre → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 74d74f8141ca983bbc9d83d3d182a0190f46509e
4
- data.tar.gz: 07155718c11bb44984f207e4df93a852bfab5917
3
+ metadata.gz: 0e89242dc146a5c9573f8d63e6562cdfb2d737af
4
+ data.tar.gz: 633f5d342cec24bf1ccf5333aea83790450aaed8
5
5
  SHA512:
6
- metadata.gz: 9bf5f5c666977b852792854fe7558829c64bb5e4a46418dd4c82c04dec1329c6eee1b0e11826bbf879afcb3fbb3e8158d2853ed74ff405ce6bca1e57dd542002
7
- data.tar.gz: 7562f702a727bc65ad81a8de119eb03356a120127e32331b0eedfca5ebcf5ea29fb3029c25ea783742f33ff312263629664c4182bb45a7efcba9b27f7762ecbe
6
+ metadata.gz: 228935be4ec664600e892ad3db85744beb98d4838926ae799c8004a34477e0edb62a80f488a8b85addf19cc0863207907f94867f29d9afdda3fd5beb13072549
7
+ data.tar.gz: d3d25104450cdfd1d699d3737d1dfabf3481c2cbc31ae216d6926af99e5b16d199912f6720067d92036242e75ca2245fa28d79c237bfb9d03ed879a8e049be2a
@@ -8,9 +8,12 @@ rvm:
8
8
  - ree
9
9
  - jruby-18mode
10
10
  - jruby-19mode
11
- - rbx-18mode
12
- - rbx-19mode
11
+ - rbx
13
12
  - 2.0.0
13
+ - 2.1.0
14
+ env:
15
+ - BRANCH=master
16
+ - BRANCH=2-99-maintenance
14
17
  matrix:
15
18
  allow_failures:
16
19
  - rvm: rbx-19mode
@@ -0,0 +1,22 @@
1
+ ### 1.0.0 / 2014-02-07
2
+ [full changelog](http://github.com/rspec/rspec-its/compare/v1.0.0.pre...master)
3
+
4
+ Breaking Changes:
5
+
6
+
7
+ Enhancements:
8
+ * Add `is_expected` support to match RSpec 3.0
9
+
10
+ Deprecations:
11
+
12
+
13
+ Bug Fixes:
14
+ * Report failures and backtrace from client perspective
15
+
16
+
17
+ ### 1.0.0.pre / 2013-10-11
18
+
19
+ Features
20
+
21
+ * Initial extraction of `its()` functionality to separate gem
22
+
data/Gemfile CHANGED
@@ -8,12 +8,22 @@ gemspec
8
8
  if File.exist?(library_path)
9
9
  gem lib, :path => library_path
10
10
  else
11
- gem lib, :git => "git://github.com/rspec/#{lib}.git"
11
+ gem lib, :git => "git://github.com/rspec/#{lib}.git",
12
+ :branch => ENV.fetch('BRANCH','master')
12
13
  end
13
14
  end
14
15
 
16
+ # only pull rspec-support from master
17
+
18
+ gem "rspec-support", :git => "git://github.com/rspec/rspec-support.git"
19
+
15
20
  # test coverage
16
- gem 'simplecov', :require => false
17
- gem 'coveralls', :require => false
21
+ # gem 'simplecov', :require => false
22
+
23
+ gem 'coveralls', :require => false, :platform => :mri_20
18
24
 
19
25
  eval File.read('Gemfile-custom') if File.exist?('Gemfile-custom')
26
+
27
+ platform :rbx do
28
+ gem 'rubysl'
29
+ end
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # RSpec::Its [![Build Status](https://travis-ci.org/palfvin/rspec-its.png)](https://travis-ci.org/palfvin/rspec-its)
1
+ # RSpec::Its [![Build Status](https://travis-ci.org/rspec/rspec-its.png)](https://travis-ci.org/rspec/rspec-its)
2
2
 
3
3
  RSpec::Its provides the `its` method as a short-hand to specify the expected value of an attribute.
4
4
 
@@ -20,7 +20,7 @@ Or install it yourself as:
20
20
 
21
21
  Use the `its` method to generate a nested example group with
22
22
  a single example that specifies the expected value of an attribute of the
23
- subject. This can be used with an implicit or explicit subject.
23
+ subject using `should`, `should_not` or `is_expected`.
24
24
 
25
25
  `its` accepts a symbol or a string, and a block representing the example.
26
26
 
@@ -30,12 +30,12 @@ subject. This can be used with an implicit or explicit subject.
30
30
  You can use a string with dots to specify a nested attribute (i.e. an
31
31
  attribute of the attribute of the subject).
32
32
 
33
- its("phone_numbers.size") { should eq(2) }
33
+ its("phone_numbers.size") { should_not eq(0) }
34
34
 
35
35
  When the subject is a hash, you can pass in an array with a single key to
36
36
  access the value at that key in the hash.
37
37
 
38
- its([:key]) { should eq(value) }
38
+ its([:key]) { is_expected.to eq(value) }
39
39
 
40
40
  ## Contributing
41
41
 
@@ -1,42 +1,5 @@
1
1
  Feature: attribute of subject
2
2
 
3
- Use the `its` method as a short-hand to generate a nested example group with
4
- a single example that specifies the expected value of an attribute of the
5
- subject. This can be used with an implicit or explicit subject.
6
-
7
- `its` accepts a symbol or a string, and a block representing the example.
8
-
9
- its(:size) { should eq(1) }
10
- its("length") { should eq(1) }
11
-
12
- You can use a string with dots to specify a nested attribute (i.e. an
13
- attribute of the attribute of the subject).
14
-
15
- its("phone_numbers.size") { should eq(2) }
16
-
17
- When the subject is a hash, you can pass in an array with a single key to
18
- access the value at that key in the hash.
19
-
20
- its([:key]) { should eq(value) }
21
-
22
- Scenario: specify value of an attribute
23
- Given a file named "example_spec.rb" with:
24
- """ruby
25
- describe Array do
26
- context "when first created" do
27
- its(:size) { should eq(0) }
28
- end
29
- end
30
- """
31
- When I run rspec with the documentation option
32
- Then the output should contain:
33
- """
34
- Array
35
- when first created
36
- size
37
- should eq 0
38
- """
39
-
40
3
  Scenario: specify value of a nested attribute
41
4
  Given a file named "example_spec.rb" with:
42
5
  """ruby
@@ -58,6 +58,15 @@ module RSpec
58
58
  # its(:count) { should eq(2) }
59
59
  # end
60
60
  #
61
+ # With an implicit subject, `is_expected` can be used as an alternative
62
+ # to `should` (e.g. for one-liner use)
63
+ #
64
+ # @example
65
+ #
66
+ # describe Array do
67
+ # its(:size) { is_expected.to eq(0) }
68
+ # end
69
+ #
61
70
  # Note that this method does not modify `subject` in any way, so if you
62
71
  # refer to `subject` in `let` or `before` blocks, you're still
63
72
  # referring to the outer subject.
@@ -82,6 +91,10 @@ module RSpec
82
91
  end
83
92
  end
84
93
 
94
+ def is_expected
95
+ expect(__its_subject)
96
+ end
97
+
85
98
  def should(matcher=nil, message=nil)
86
99
  RSpec::Expectations::PositiveExpectationHandler.handle_matcher(__its_subject, matcher, message)
87
100
  end
@@ -1,5 +1,5 @@
1
1
  module RSpec
2
2
  module Its
3
- VERSION = "1.0.0.pre"
3
+ VERSION = "1.0.0"
4
4
  end
5
5
  end
@@ -18,6 +18,8 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
+ spec.add_runtime_dependency 'rspec-core', '>= 2.99.0.beta1'
22
+ spec.add_runtime_dependency 'rspec-expectations', '>= 2.99.0.beta1'
21
23
  spec.add_development_dependency 'bundler', '~> 1.3'
22
24
  spec.add_development_dependency 'rake', '~> 10.1.0'
23
25
  spec.add_development_dependency 'cucumber', '~> 1.3.8'
@@ -41,6 +41,15 @@ module RSpec
41
41
  its("name") { should eq("John") }
42
42
  its("name.size") { should eq(4) }
43
43
  its("name.size.class") { should eq(Fixnum) }
44
+
45
+ context "using should_not" do
46
+ its("name") { should_not eq("Paul") }
47
+ end
48
+
49
+ context "using is_expected" do
50
+ its("name") { is_expected.to eq("John") }
51
+ end
52
+
44
53
  end
45
54
 
46
55
  context "when it responds to #[]" do
@@ -61,7 +70,7 @@ module RSpec
61
70
  its(['a']) { should eq("String: a") }
62
71
  its([:b, 'c', 4]) { should eq("Symbol: b; String: c; Fixnum: 4") }
63
72
  its(:name) { should eq("George") }
64
- context "when referring to an attribute without the proper array syntax" do
73
+ context "when referring to an attribute that doesn't exist" do
65
74
  context "it raises an error" do
66
75
  its(:age) do
67
76
  expect do
metadata CHANGED
@@ -1,15 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-its
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Alfvin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-16 00:00:00.000000000 Z
11
+ date: 2014-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec-core
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: 2.99.0.beta1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: 2.99.0.beta1
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec-expectations
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: 2.99.0.beta1
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: 2.99.0.beta1
13
41
  - !ruby/object:Gem::Dependency
14
42
  name: bundler
15
43
  requirement: !ruby/object:Gem::Requirement
@@ -76,6 +104,7 @@ files:
76
104
  - .gitignore
77
105
  - .rspec
78
106
  - .travis.yml
107
+ - Changelog.md
79
108
  - Gemfile
80
109
  - LICENSE.txt
81
110
  - README.md
@@ -105,9 +134,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
105
134
  version: '0'
106
135
  required_rubygems_version: !ruby/object:Gem::Requirement
107
136
  requirements:
108
- - - '>'
137
+ - - '>='
109
138
  - !ruby/object:Gem::Version
110
- version: 1.3.1
139
+ version: '0'
111
140
  requirements: []
112
141
  rubyforge_project:
113
142
  rubygems_version: 2.0.3