common_assert 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3af36f27e2a134a4d2300efc94967079632dc8f2
4
+ data.tar.gz: 7068a966a3ecc73aac5d6ffb87fc516b71cf0696
5
+ SHA512:
6
+ metadata.gz: 96ed7ca49bb3e57ee6fb275a172dadcdb7ea1e331f72670d06b010445dc83ec78ed80599e364776f8df4adaec8a0d9f857e456cfb08ca3a71d1d31e8df2f0e52
7
+ data.tar.gz: 4b3733b6afb82c2370ca3c1d3b78896ce3c391a39be81bc192ddf2254dc001e57c41706122a6db1851aff6421a79003bfdb926d3320ba7a13546de80a2d8ed2e
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ -f d
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org/'
2
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,52 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ common_assert (0.0.1)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ ansi (1.5.0)
10
+ builder (3.2.2)
11
+ coderay (1.1.0)
12
+ diff-lcs (1.2.5)
13
+ method_source (0.8.2)
14
+ minitest (5.8.1)
15
+ minitest-reporters (1.1.4)
16
+ ansi
17
+ builder
18
+ minitest (>= 5.0)
19
+ ruby-progressbar
20
+ pry (0.10.3)
21
+ coderay (~> 1.1.0)
22
+ method_source (~> 0.8.1)
23
+ slop (~> 3.4)
24
+ rake (10.4.2)
25
+ rspec (3.3.0)
26
+ rspec-core (~> 3.3.0)
27
+ rspec-expectations (~> 3.3.0)
28
+ rspec-mocks (~> 3.3.0)
29
+ rspec-core (3.3.2)
30
+ rspec-support (~> 3.3.0)
31
+ rspec-expectations (3.3.1)
32
+ diff-lcs (>= 1.2.0, < 2.0)
33
+ rspec-support (~> 3.3.0)
34
+ rspec-mocks (3.3.2)
35
+ diff-lcs (>= 1.2.0, < 2.0)
36
+ rspec-support (~> 3.3.0)
37
+ rspec-support (3.3.0)
38
+ ruby-progressbar (1.7.5)
39
+ slop (3.6.0)
40
+
41
+ PLATFORMS
42
+ ruby
43
+
44
+ DEPENDENCIES
45
+ common_assert!
46
+ minitest-reporters (= 1.1.4)
47
+ pry
48
+ rake
49
+ rspec (= 3.3.0)
50
+
51
+ BUNDLED WITH
52
+ 1.10.6
data/README.md ADDED
@@ -0,0 +1 @@
1
+ # common_assert
data/Rakefile ADDED
@@ -0,0 +1,9 @@
1
+ task(:test) {
2
+ [
3
+ 'ruby test/*',
4
+ 'rspec spec/specs/common_assert_expect_spec.rb',
5
+ 'rspec spec/specs/common_assert_should_spec.rb',
6
+ ].each do |cmd|
7
+ system("bundle exec #{cmd}")
8
+ end
9
+ }
@@ -0,0 +1,17 @@
1
+ Gem::Specification.new do |gem|
2
+ gem.name = 'common_assert'
3
+ gem.version = '0.0.1'
4
+ gem.summary = 'assertion with test unit or rspec'
5
+ gem.author = 'Lihan Li'
6
+ gem.email = 'frankieteardrop@gmail.com'
7
+ gem.homepage = 'https://github.com/lihanli/common_assert'
8
+
9
+ gem.add_development_dependency('rspec', '3.3.0')
10
+ gem.add_development_dependency('minitest-reporters', '1.1.4')
11
+ gem.add_development_dependency('pry')
12
+ gem.add_development_dependency('rake')
13
+
14
+ gem.files = `git ls-files`.split("\n")
15
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
+ gem.require_paths = ["lib"]
17
+ end
@@ -0,0 +1,19 @@
1
+ module CommonAssert
2
+ def self.included(klass)
3
+ assert_code = if defined?(RSpec)
4
+ if RSpec.configuration.expect_with[0].configuration.syntax.include?(:expect)
5
+ 'expect(value).to eq(expected)'
6
+ else
7
+ 'value.should == expected'
8
+ end
9
+ else
10
+ 'assert_equal(expected, value)'
11
+ end
12
+
13
+ class_eval %Q(
14
+ def common_assert_equal(value, expected)
15
+ #{assert_code}
16
+ end
17
+ )
18
+ end
19
+ end
@@ -0,0 +1,10 @@
1
+ require 'common_assert'
2
+ require 'pry'
3
+
4
+ def configure_rspec_expectation_syntax(syntax)
5
+ RSpec.configure { |config|
6
+ config.expect_with(:rspec) { |c|
7
+ c.syntax = syntax
8
+ }
9
+ }
10
+ end
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+ configure_rspec_expectation_syntax(:expect)
4
+
5
+ RSpec.describe(CommonAssert) {
6
+ include CommonAssert
7
+
8
+ it('#common_assert_equal should work') {
9
+ common_assert_equal(true, true)
10
+
11
+ expect {
12
+ common_assert_equal(true, false)
13
+ }.to raise_error(RSpec::Expectations::ExpectationNotMetError)
14
+ }
15
+ }
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+ configure_rspec_expectation_syntax(:should)
4
+
5
+ RSpec.describe(CommonAssert) {
6
+ include CommonAssert
7
+
8
+ it('#common_assert_equal should work') {
9
+ common_assert_equal(true, true)
10
+
11
+ lambda {
12
+ common_assert_equal(true, false)
13
+ }.should raise_error(RSpec::Expectations::ExpectationNotMetError)
14
+ }
15
+ }
@@ -0,0 +1,18 @@
1
+ require 'common_assert'
2
+ require 'pry'
3
+ require "minitest/autorun"
4
+ require "minitest/reporters"
5
+
6
+ Minitest::Reporters.use!(Minitest::Reporters::SpecReporter.new)
7
+
8
+ class CommonAssertTest < Minitest::Test
9
+ include CommonAssert
10
+
11
+ def test_equal
12
+ common_assert_equal(true, true)
13
+
14
+ assert_raises(Minitest::Assertion) {
15
+ common_assert_equal(true, false)
16
+ }
17
+ end
18
+ end
metadata ADDED
@@ -0,0 +1,113 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: common_assert
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Lihan Li
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-10-21 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.3.0
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 3.3.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: minitest-reporters
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '='
32
+ - !ruby/object:Gem::Version
33
+ version: 1.1.4
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
40
+ version: 1.1.4
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description:
70
+ email: frankieteardrop@gmail.com
71
+ executables: []
72
+ extensions: []
73
+ extra_rdoc_files: []
74
+ files:
75
+ - ".rspec"
76
+ - Gemfile
77
+ - Gemfile.lock
78
+ - README.md
79
+ - Rakefile
80
+ - common_assert.gemspec
81
+ - lib/common_assert.rb
82
+ - spec/spec_helper.rb
83
+ - spec/specs/common_assert_expect_spec.rb
84
+ - spec/specs/common_assert_should_spec.rb
85
+ - test/common_assert_test.rb
86
+ homepage: https://github.com/lihanli/common_assert
87
+ licenses: []
88
+ metadata: {}
89
+ post_install_message:
90
+ rdoc_options: []
91
+ require_paths:
92
+ - lib
93
+ required_ruby_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ required_rubygems_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ requirements: []
104
+ rubyforge_project:
105
+ rubygems_version: 2.4.5.1
106
+ signing_key:
107
+ specification_version: 4
108
+ summary: assertion with test unit or rspec
109
+ test_files:
110
+ - spec/spec_helper.rb
111
+ - spec/specs/common_assert_expect_spec.rb
112
+ - spec/specs/common_assert_should_spec.rb
113
+ - test/common_assert_test.rb