rspec-will_be_expected 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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e31e4d875fbaaef3c11e8513d3eb5d0ad8c01e4f
4
+ data.tar.gz: 40d3b55e311f4875e1dc2b96eedb51e65f5e09b7
5
+ SHA512:
6
+ metadata.gz: a0fe379aaa02b2bbbff3d5b0a72fefb228640bd97a153c4db54dfbd23c6f52c0cdda2340e74e98d4fbe7ff990ef8fd3e64e6b75af1a8921fd0556f7e42110de6
7
+ data.tar.gz: ce581cda5ce8f6cd9ee77ceea5caf89a87b565c2ba61b68ade4c3305afba70481d49ba9592ba3400b3da7f76ccefff847578e0b22fe9a3bb481cc819f8dce622
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ .ruby-version
12
+ .ruby-gemset
13
+
14
+ *.gem
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ - 2.1
6
+ - 2.2
7
+ - ruby-head
8
+ - jruby-head
9
+ - rbx-2
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rspec-will_be_expected.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,72 @@
1
+ # Rspec::WillBeExpected
2
+
3
+ [![Build Status](https://travis-ci.org/d-unseductable/rspec-will_be_expected.svg?branch=master)](https://travis-ci.org/d-unseductable/rspec-will_be_expected)
4
+
5
+ Designed to prettify one-liners when you have block expectations for subject.
6
+
7
+ Creates an alias `RSpec::Core::MemoizedHelpers.will_be_expected` to
8
+ `expect { subject }`
9
+
10
+ Simple to use:
11
+
12
+ ```ruby
13
+ class SimplePrinter
14
+ def initialize
15
+ print 'Printer is ready'
16
+ end
17
+ end
18
+ ```
19
+
20
+ This goes to
21
+
22
+ ```ruby
23
+ it { will_be_expected.to output('Printer is ready').to_stdout }
24
+ ```
25
+
26
+ instead of
27
+
28
+ ```ruby
29
+ specify { expect { subject }.to output('Printer is ready').to_stdout }
30
+ ```
31
+
32
+ For more complicated cases:
33
+
34
+ ```ruby
35
+ describe UserFactory do
36
+ subject { UserFactory.create_user }
37
+
38
+ it { will_be_expected.to change(User.count).by(1) }
39
+ it { will_be_expected.to output.to_stdout }
40
+
41
+ context 'with database issues' do
42
+ it { will_be_expected.to output.to_stderr }
43
+ it { will_be_expected.to raise_error }
44
+ end
45
+ end
46
+ ```
47
+
48
+ This change allows to DRY up, prettify and make specs even more readable.
49
+
50
+ ## Installation
51
+
52
+ Add this line to your application's Gemfile:
53
+
54
+ ```ruby
55
+ gem 'rspec-will_be_expected'
56
+ ```
57
+
58
+ And then execute:
59
+
60
+ $ bundle
61
+
62
+ Or install it yourself as:
63
+
64
+ $ gem install rspec-will_be_expected
65
+
66
+ ## Contributing
67
+
68
+ 1. Fork it ( https://github.com/d-unseductable/rspec-will_be_expected/fork )
69
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
70
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
71
+ 4. Push to the branch (`git push origin my-new-feature`)
72
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "rspec/will_be_expected"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,5 @@
1
+ module Rspec
2
+ module WillBeExpected
3
+ VERSION = '0.0.1'
4
+ end
5
+ end
@@ -0,0 +1,39 @@
1
+ require 'rspec/will_be_expected/version'
2
+ require 'rspec/core'
3
+
4
+ module RSpec
5
+ module WillBeExpected
6
+ # Wraps the `subject` in `expect` with block to make it the target
7
+ # of an expectation.
8
+ # Designed to easily use expectations with blocks for one-liners.
9
+ #
10
+ # @example
11
+
12
+ # describe UserFactory do
13
+ # subject { UserFactory.create_user }
14
+ #
15
+ # it { will_be_expected.to change(User.count).by(1) }
16
+ # it { will_be_expected.to output.to_stdout }
17
+ #
18
+ # context 'with database issues' do
19
+ # it { will_be_expected.to output.to_stderr }
20
+ # it { will_be_expected.to raise_error }
21
+ # end
22
+ # end
23
+ #
24
+ # @see #subject
25
+ # @see #should
26
+ # @see #is_expected
27
+ #
28
+ # @note This only works if you are using rspec-expectations.
29
+ def will_be_expected
30
+ expect { subject }
31
+ end
32
+ end
33
+ end
34
+
35
+ RSpec.configure do |config|
36
+ config.include(RSpec::WillBeExpected)
37
+ end
38
+
39
+ RSpec::Core::MemoizedHelpers.send(:include, RSpec::WillBeExpected)
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rspec/will_be_expected/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "rspec-will_be_expected"
8
+ spec.version = Rspec::WillBeExpected::VERSION
9
+ spec.authors = ["Dmitry Gritsay"]
10
+ spec.email = ["unseductable@gmail.com"]
11
+
12
+ spec.summary = %q{One-liner for block expectations}
13
+ spec.description = %q{One-liner for block expectations}
14
+ spec.homepage = "https://github.com/d-unseductable/rspec-will_be_expected"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.bindir = "exe"
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "rspec", "~> 3.0"
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.6"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+ end
metadata ADDED
@@ -0,0 +1,96 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rspec-will_be_expected
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Dmitry Gritsay
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-04-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.6'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.6'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ description: One-liner for block expectations
56
+ email:
57
+ - unseductable@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".rspec"
64
+ - ".travis.yml"
65
+ - Gemfile
66
+ - README.md
67
+ - Rakefile
68
+ - bin/console
69
+ - bin/setup
70
+ - lib/rspec/will_be_expected.rb
71
+ - lib/rspec/will_be_expected/version.rb
72
+ - rspec-will_be_expected.gemspec
73
+ homepage: https://github.com/d-unseductable/rspec-will_be_expected
74
+ licenses: []
75
+ metadata: {}
76
+ post_install_message:
77
+ rdoc_options: []
78
+ require_paths:
79
+ - lib
80
+ required_ruby_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ required_rubygems_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ requirements: []
91
+ rubyforge_project:
92
+ rubygems_version: 2.4.5
93
+ signing_key:
94
+ specification_version: 4
95
+ summary: One-liner for block expectations
96
+ test_files: []