warp 1.0.1 → 1.1.0

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.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rspec +3 -0
  4. data/.travis.yml +35 -8
  5. data/Appraisals +67 -0
  6. data/Gemfile +4 -5
  7. data/README.md +57 -8
  8. data/Rakefile +4 -1
  9. data/gemfiles/rails_3.2_rspec_2.14.gemfile +22 -0
  10. data/gemfiles/rails_3.2_rspec_2.99.0.beta1.gemfile +22 -0
  11. data/gemfiles/rails_3.2_rspec_3.0.0.beta1.gemfile +23 -0
  12. data/gemfiles/rails_3.2_rspec_master.gemfile +23 -0
  13. data/gemfiles/rails_4.0_rspec_2.14.gemfile +22 -0
  14. data/gemfiles/rails_4.0_rspec_2.99.0.beta1.gemfile +22 -0
  15. data/gemfiles/rails_4.0_rspec_3.0.0.beta1.gemfile +23 -0
  16. data/gemfiles/rails_4.0_rspec_master.gemfile +23 -0
  17. data/gemfiles/rails_4.1.0.beta1_rspec_2.14.gemfile +23 -0
  18. data/gemfiles/rails_4.1.0.beta1_rspec_2.99.0.beta1.gemfile +23 -0
  19. data/gemfiles/rails_4.1.0.beta1_rspec_3.0.0.beta1.gemfile +24 -0
  20. data/gemfiles/rails_4.1.0.beta1_rspec_master.gemfile +24 -0
  21. data/lib/warp/controller_matchers/assign_matcher.rb +1 -3
  22. data/lib/warp/controller_matchers/set_flash_matcher.rb +19 -14
  23. data/lib/warp/matcher.rb +30 -0
  24. data/lib/warp/model_matchers/association_matcher.rb +56 -0
  25. data/lib/warp/model_matchers/attribute_matcher.rb +32 -0
  26. data/lib/warp/model_matchers/error_matcher.rb +12 -0
  27. data/lib/warp/model_matchers/matcher.rb +15 -0
  28. data/lib/warp/model_matchers/validation_matcher.rb +12 -0
  29. data/lib/warp/model_matchers.rb +10 -0
  30. data/lib/warp/version.rb +13 -1
  31. data/lib/warp.rb +4 -1
  32. data/spec/spec_helper.rb +15 -6
  33. data/spec/support/failure_message_helpers.rb +23 -0
  34. data/spec/support/match_helpers.rb +24 -12
  35. data/spec/support/model_helpers.rb +25 -0
  36. data/spec/support/with_contexts_helpers.rb +6 -0
  37. data/spec/warp/controller_matchers/assign_matcher_spec.rb +35 -33
  38. data/spec/warp/controller_matchers/set_flash_matcher_spec.rb +4 -12
  39. data/spec/warp/model_helpers/association_matcher_spec.rb +102 -0
  40. data/spec/warp/model_helpers/attribute_matcher_spec.rb +43 -0
  41. data/warp.gemspec +2 -4
  42. metadata +31 -33
  43. data/gemfiles/rails-3.2 +0 -17
  44. data/gemfiles/rails-4.0 +0 -17
  45. data/gemfiles/rails-4.1 +0 -18
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a26f9c24ab61368b029824ef4d7da7224830142b
4
- data.tar.gz: 1b26fa712ddd38e5e70ee757920f4ee8a2e89ed0
3
+ metadata.gz: f12aad08ee52c87c70887a3be0718247b7dc78d7
4
+ data.tar.gz: 3179971a7cd9251f48252413a27c15298c74d4ff
5
5
  SHA512:
6
- metadata.gz: 2a851430a6ff0293d2e4ed1978aae6afc1111af4a826ea7ce0fe006bcf64eea0279c2de0dd9f523b17df122f495a53a4427d3b5a3d87b3c0781aad9e05f82160
7
- data.tar.gz: 13504117019ea432a0947c9b6601c8ace8d90d9113a001f33becd1103e03b5b18aec2495d2959dd9f8d53f705cb41e96012f2d0822082e300b6e265e92f8029e
6
+ metadata.gz: d9b2432dca61f39830d3514b83d99337b6397fda5942f333d06fe78bf296d8b483b32f155a2ec9937a80b3e5eeab4012cba89286cde5122c8f68e1369b5124f8
7
+ data.tar.gz: 6f45e4c01f15a0fc44a2e382ea67b5ce802a7d13d353ac7e7aaa26e35ee7bf290437794c839499454fd4dde6437e6066db2d5edddd77d77a82913556105bb7b8
data/.gitignore CHANGED
@@ -15,3 +15,4 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ gemfiles/*.lock
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --format Fuubar
3
+
data/.travis.yml CHANGED
@@ -1,21 +1,48 @@
1
1
  language: ruby
2
+
3
+ env:
4
+ global:
5
+ - TRAVIS_CI=1
6
+
2
7
  rvm:
3
8
  - 1.9.2
4
9
  - 1.9.3
5
10
  - 2.0.0
6
11
  - 2.1.0
12
+
7
13
  gemfile:
8
- - gemfiles/rails-3.2
9
- - gemfiles/rails-4.0
10
- - gemfiles/rails-4.1
11
- - Gemfile
14
+ - gemfiles/rails_3.2_rspec_2.14.gemfile
15
+ - gemfiles/rails_3.2_rspec_2.99.0.beta1.gemfile
16
+ - gemfiles/rails_3.2_rspec_3.0.0.beta1.gemfile
17
+ - gemfiles/rails_3.2_rspec_master.gemfile
18
+ - gemfiles/rails_4.0_rspec_2.14.gemfile
19
+ - gemfiles/rails_4.0_rspec_2.99.0.beta1.gemfile
20
+ - gemfiles/rails_4.0_rspec_3.0.0.beta1.gemfile
21
+ - gemfiles/rails_4.0_rspec_master.gemfile
22
+ - gemfiles/rails_4.1.0.beta1_rspec_2.14.gemfile
23
+ - gemfiles/rails_4.1.0.beta1_rspec_2.99.0.beta1.gemfile
24
+ - gemfiles/rails_4.1.0.beta1_rspec_3.0.0.beta1.gemfile
25
+ - gemfiles/rails_4.1.0.beta1_rspec_master.gemfile
26
+
12
27
  matrix:
13
28
  exclude:
14
29
  - rvm: 1.9.2
15
- gemfile: gemfiles/rails-4.0
30
+ gemfile: gemfiles/rails_4.0_rspec_2.14.gemfile
16
31
  - rvm: 1.9.2
17
- gemfile: gemfiles/rails-4.1
32
+ gemfile: gemfiles/rails_4.0_rspec_2.99.0.beta1.gemfile
18
33
  - rvm: 1.9.2
19
- gemfile: Gemfile
34
+ gemfile: gemfiles/rails_4.0_rspec_3.0.0.beta1.gemfile
35
+ - rvm: 1.9.2
36
+ gemfile: gemfiles/rails_4.0_rspec_master.gemfile
37
+ - rvm: 1.9.2
38
+ gemfile: gemfiles/rails_4.1.0.beta1_rspec_2.14.gemfile
39
+ - rvm: 1.9.2
40
+ gemfile: gemfiles/rails_4.1.0.beta1_rspec_2.99.0.beta1.gemfile
41
+ - rvm: 1.9.2
42
+ gemfile: gemfiles/rails_4.1.0.beta1_rspec_3.0.0.beta1.gemfile
43
+ - rvm: 1.9.2
44
+ gemfile: gemfiles/rails_4.1.0.beta1_rspec_master.gemfile
45
+
20
46
  bundler_args: --without tools
21
- script: bundle exec rspec
47
+
48
+ script: bundle exec rspec -b
data/Appraisals ADDED
@@ -0,0 +1,67 @@
1
+ class V
2
+ def initialize(*version_parts)
3
+ @version_parts = version_parts
4
+ end
5
+
6
+ def self.[](version_string)
7
+ self.new(*version_string.split("."))
8
+ end
9
+
10
+ def gem_version
11
+ case @version_parts.size
12
+ when 2
13
+ "~> " + human_version
14
+ when 3, 4
15
+ human_version
16
+ else
17
+ raise Exception, "cannot generate gem version for #{human_version}"
18
+ end
19
+ end
20
+
21
+ def human_version
22
+ @version_parts.join(".")
23
+ end
24
+
25
+ def git?
26
+ @version_parts.size == 1
27
+ end
28
+
29
+ def branch
30
+ @version_parts[0]
31
+ end
32
+
33
+ def major
34
+ @version_parts[0]
35
+ end
36
+
37
+ def minor
38
+ git? ? nil : @version_parts[1]
39
+ end
40
+
41
+ def mm
42
+ [major, minor].join(".")
43
+ end
44
+
45
+ def mm?(version)
46
+ mm == version
47
+ end
48
+ end
49
+
50
+ [V["3.2"], V["4.0"], V["4.1.0.beta1"]].each do |rails|
51
+ [V["2.14"], V["2.99.0.beta1"], V["3.0.0.beta1"], V["master"]].each do |rspec|
52
+ appraise "rails-#{rails.human_version}-rspec-#{rspec.human_version}" do
53
+ gem "activesupport", rails.gem_version, require: "active_support/all"
54
+ gem "actionpack", rails.gem_version, require: "action_controller"
55
+ gem "activerecord", rails.gem_version, require: "active_record"
56
+ gem "actionview", rails.gem_version, require: "action_view" if rails.mm?("4.1")
57
+
58
+ ["rspec", "rspec-core", "rspec-expectations", "rspec-mocks", "rspec-support"].each do |rspec_gem|
59
+ if rspec.git?
60
+ gem rspec_gem, git: "https://github.com/rspec/#{rspec_gem}.git", branch: rspec.branch
61
+ elsif rspec_gem != "rspec-support" || rspec.mm?("3.0")
62
+ gem rspec_gem, rspec.gem_version
63
+ end
64
+ end
65
+ end
66
+ end
67
+ end
data/Gemfile CHANGED
@@ -2,11 +2,10 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
- gem "rspec", git: "https://github.com/rspec/rspec.git"
6
- gem "rspec-core", git: "https://github.com/rspec/rspec-core.git"
7
- gem "rspec-expectations", git: "https://github.com/rspec/rspec-expectations.git"
8
- gem "rspec-mocks", git: "https://github.com/rspec/rspec-mocks.git"
9
- gem "rspec-support", git: "https://github.com/rspec/rspec-support.git"
5
+ gem "appraisal", "1.0.0.beta2"
6
+
7
+ gem "simplecov", require: false
8
+ gem "coveralls", require: false
10
9
 
11
10
  group :tools do
12
11
  gem "guard"
data/README.md CHANGED
@@ -1,12 +1,13 @@
1
1
  # Warp
2
2
 
3
3
  [![Build Status](https://travis-ci.org/thomasfedb/warp.png)](https://travis-ci.org/thomasfedb/warp)
4
+ [![Coverage Status](https://coveralls.io/repos/thomasfedb/warp/badge.png?branch=master)](https://coveralls.io/r/thomasfedb/warp?branch=master)
4
5
  [![Gem Version](https://badge.fury.io/rb/warp.png)](http://rubygems.org/gems/warp)
5
6
  [![Code Climate](https://codeclimate.com/github/thomasfedb/warp.png)](https://codeclimate.com/github/thomasfedb/warp)
6
7
 
7
8
  RSpec Matchers to simplify writing unit and feature tests for your Rails applications.
8
9
 
9
- Compatible with Ruby 1.9.2 and greater, and Rails 3.2 and greater.
10
+ Compatible with Ruby 1.9.2 and greater, Rails 3.2 and greater, and RSpec 2.14.1 and greater.
10
11
 
11
12
  ## Installation
12
13
 
@@ -20,7 +21,9 @@ And then execute:
20
21
 
21
22
  ## Usage
22
23
 
23
- ### assigns(key)
24
+ ### Controller Matchers
25
+
26
+ #### assigns(key)
24
27
 
25
28
  Ensures that the specific assign is set:
26
29
 
@@ -28,7 +31,7 @@ Ensures that the specific assign is set:
28
31
  specify { expect(controller).to assign(:posts) }
29
32
  ```
30
33
 
31
- ### assigns(key).with(object)
34
+ #### assigns(key).with(object)
32
35
 
33
36
  Ensures that the specific assign is set with the specified value:
34
37
 
@@ -36,7 +39,7 @@ Ensures that the specific assign is set with the specified value:
36
39
  specify { expect(controller).to assign(:posts).with(posts) }
37
40
  ```
38
41
 
39
- ### assigns(key).with_a(klass)
42
+ #### assigns(key).with_a(klass)
40
43
 
41
44
  Ensures that the specific assign is set with an instance of the specified class:
42
45
 
@@ -44,7 +47,7 @@ Ensures that the specific assign is set with an instance of the specified class:
44
47
  specify { expect(controller).to assign(:post).with_a(Post) }
45
48
  ```
46
49
 
47
- ### assigns(key).with_a_new(klass)
50
+ #### assigns(key).with_a_new(klass)
48
51
 
49
52
  Ensures that the specific assign is set with a instance of the specified class that is not persisted:
50
53
 
@@ -52,14 +55,14 @@ Ensures that the specific assign is set with a instance of the specified class t
52
55
  specify { expect(controller).to assign(:post).with_a_new(Post) }
53
56
  ```
54
57
 
55
- ### set_flash(key)
58
+ #### set_flash(key)
56
59
 
57
60
  Ensure that the specific flash key is set:
58
61
 
59
62
  ```ruby
60
63
  specify { expect(controller).to set_flash(:notice) }
61
64
  ```
62
- ### set_flash(key).to(value)
65
+ #### set_flash(key).to(value)
63
66
 
64
67
  Ensure that the specific flash key is set:
65
68
 
@@ -67,6 +70,52 @@ Ensure that the specific flash key is set:
67
70
  specify { expect(controller).to set_flash(:notice).to("Your order has been processed.") }
68
71
  ```
69
72
 
73
+ ### Model Matchers
74
+
75
+ #### belongs_to(association)
76
+
77
+ Ensures that a `belongs_to` association is present:
78
+
79
+ ```ruby
80
+ specify { expect(comment).to belongs_to(:post) }
81
+ ```
82
+
83
+ Works with either model classes or model objects.
84
+
85
+ #### have_many(association)
86
+
87
+ Ensures that a `has_many` association is present:
88
+
89
+ ```ruby
90
+ specify { expect(post).to have_many(:comments) }
91
+ ```
92
+
93
+ #### have_one(association)
94
+
95
+ Ensures that a `has_one` association is present:
96
+
97
+ ```ruby
98
+ specify { expect(person).to have_one(:address) }
99
+ ```
100
+
101
+ #### have_and_belong_to_many(association)
102
+
103
+ Ensures that a `has_and_belongs_to_many` association is present:
104
+
105
+ ```ruby
106
+ specify { expect(group).to have_and_belong_to_many(:users) }
107
+ ```
108
+
109
+ This matcher is not avaliable on Rails 4.1+, as these versions of Rails will create a `has_many :though` association instead of a 'has_and_belongs_to_many' association.
110
+
111
+ #### have_attribute(attribute)
112
+
113
+ Checks if a certain attribute is present on a model. Works against models or model instances.
114
+
115
+ ```ruby
116
+ specify { expect(user).to have_attribute(:name) }
117
+ ```
118
+
70
119
  ## Contributing
71
120
 
72
121
  1. Fork it
@@ -74,4 +123,4 @@ specify { expect(controller).to set_flash(:notice).to("Your order has been proce
74
123
  3. Add your feature and specs.
75
124
  4. Commit your changes (`git commit -am 'Add some feature'`)
76
125
  5. Push to the branch (`git push origin my-new-feature`)
77
- 6. Create new Pull Request
126
+ 6. Create new Pull Request
data/Rakefile CHANGED
@@ -1 +1,4 @@
1
- require "bundler/gem_tasks"
1
+ require "rubygems"
2
+ require "bundler/setup"
3
+
4
+ require "bundler/gem_tasks"
@@ -0,0 +1,22 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal", "1.0.0.beta2"
6
+ gem "simplecov", :require=>false
7
+ gem "coveralls", :require=>false
8
+ gem "activesupport", "~> 3.2", :require=>"active_support/all"
9
+ gem "actionpack", "~> 3.2", :require=>"action_controller"
10
+ gem "activerecord", "~> 3.2", :require=>"active_record"
11
+ gem "rspec", "~> 2.14"
12
+ gem "rspec-core", "~> 2.14"
13
+ gem "rspec-expectations", "~> 2.14"
14
+ gem "rspec-mocks", "~> 2.14"
15
+
16
+ group :tools do
17
+ gem "guard"
18
+ gem "guard-rspec"
19
+ gem "byebug"
20
+ end
21
+
22
+ gemspec :path=>".././"
@@ -0,0 +1,22 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal", "1.0.0.beta2"
6
+ gem "simplecov", :require=>false
7
+ gem "coveralls", :require=>false
8
+ gem "activesupport", "~> 3.2", :require=>"active_support/all"
9
+ gem "actionpack", "~> 3.2", :require=>"action_controller"
10
+ gem "activerecord", "~> 3.2", :require=>"active_record"
11
+ gem "rspec", "2.99.0.beta1"
12
+ gem "rspec-core", "2.99.0.beta1"
13
+ gem "rspec-expectations", "2.99.0.beta1"
14
+ gem "rspec-mocks", "2.99.0.beta1"
15
+
16
+ group :tools do
17
+ gem "guard"
18
+ gem "guard-rspec"
19
+ gem "byebug"
20
+ end
21
+
22
+ gemspec :path=>".././"
@@ -0,0 +1,23 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal", "1.0.0.beta2"
6
+ gem "simplecov", :require=>false
7
+ gem "coveralls", :require=>false
8
+ gem "activesupport", "~> 3.2", :require=>"active_support/all"
9
+ gem "actionpack", "~> 3.2", :require=>"action_controller"
10
+ gem "activerecord", "~> 3.2", :require=>"active_record"
11
+ gem "rspec", "3.0.0.beta1"
12
+ gem "rspec-core", "3.0.0.beta1"
13
+ gem "rspec-expectations", "3.0.0.beta1"
14
+ gem "rspec-mocks", "3.0.0.beta1"
15
+ gem "rspec-support", "3.0.0.beta1"
16
+
17
+ group :tools do
18
+ gem "guard"
19
+ gem "guard-rspec"
20
+ gem "byebug"
21
+ end
22
+
23
+ gemspec :path=>".././"
@@ -0,0 +1,23 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal", "1.0.0.beta2"
6
+ gem "simplecov", :require=>false
7
+ gem "coveralls", :require=>false
8
+ gem "activesupport", "~> 3.2", :require=>"active_support/all"
9
+ gem "actionpack", "~> 3.2", :require=>"action_controller"
10
+ gem "activerecord", "~> 3.2", :require=>"active_record"
11
+ gem "rspec", :git=>"https://github.com/rspec/rspec.git", :branch=>"master"
12
+ gem "rspec-core", :git=>"https://github.com/rspec/rspec-core.git", :branch=>"master"
13
+ gem "rspec-expectations", :git=>"https://github.com/rspec/rspec-expectations.git", :branch=>"master"
14
+ gem "rspec-mocks", :git=>"https://github.com/rspec/rspec-mocks.git", :branch=>"master"
15
+ gem "rspec-support", :git=>"https://github.com/rspec/rspec-support.git", :branch=>"master"
16
+
17
+ group :tools do
18
+ gem "guard"
19
+ gem "guard-rspec"
20
+ gem "byebug"
21
+ end
22
+
23
+ gemspec :path=>".././"
@@ -0,0 +1,22 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal", "1.0.0.beta2"
6
+ gem "simplecov", :require=>false
7
+ gem "coveralls", :require=>false
8
+ gem "activesupport", "~> 4.0", :require=>"active_support/all"
9
+ gem "actionpack", "~> 4.0", :require=>"action_controller"
10
+ gem "activerecord", "~> 4.0", :require=>"active_record"
11
+ gem "rspec", "~> 2.14"
12
+ gem "rspec-core", "~> 2.14"
13
+ gem "rspec-expectations", "~> 2.14"
14
+ gem "rspec-mocks", "~> 2.14"
15
+
16
+ group :tools do
17
+ gem "guard"
18
+ gem "guard-rspec"
19
+ gem "byebug"
20
+ end
21
+
22
+ gemspec :path=>".././"
@@ -0,0 +1,22 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal", "1.0.0.beta2"
6
+ gem "simplecov", :require=>false
7
+ gem "coveralls", :require=>false
8
+ gem "activesupport", "~> 4.0", :require=>"active_support/all"
9
+ gem "actionpack", "~> 4.0", :require=>"action_controller"
10
+ gem "activerecord", "~> 4.0", :require=>"active_record"
11
+ gem "rspec", "2.99.0.beta1"
12
+ gem "rspec-core", "2.99.0.beta1"
13
+ gem "rspec-expectations", "2.99.0.beta1"
14
+ gem "rspec-mocks", "2.99.0.beta1"
15
+
16
+ group :tools do
17
+ gem "guard"
18
+ gem "guard-rspec"
19
+ gem "byebug"
20
+ end
21
+
22
+ gemspec :path=>".././"
@@ -0,0 +1,23 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal", "1.0.0.beta2"
6
+ gem "simplecov", :require=>false
7
+ gem "coveralls", :require=>false
8
+ gem "activesupport", "~> 4.0", :require=>"active_support/all"
9
+ gem "actionpack", "~> 4.0", :require=>"action_controller"
10
+ gem "activerecord", "~> 4.0", :require=>"active_record"
11
+ gem "rspec", "3.0.0.beta1"
12
+ gem "rspec-core", "3.0.0.beta1"
13
+ gem "rspec-expectations", "3.0.0.beta1"
14
+ gem "rspec-mocks", "3.0.0.beta1"
15
+ gem "rspec-support", "3.0.0.beta1"
16
+
17
+ group :tools do
18
+ gem "guard"
19
+ gem "guard-rspec"
20
+ gem "byebug"
21
+ end
22
+
23
+ gemspec :path=>".././"
@@ -0,0 +1,23 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal", "1.0.0.beta2"
6
+ gem "simplecov", :require=>false
7
+ gem "coveralls", :require=>false
8
+ gem "activesupport", "~> 4.0", :require=>"active_support/all"
9
+ gem "actionpack", "~> 4.0", :require=>"action_controller"
10
+ gem "activerecord", "~> 4.0", :require=>"active_record"
11
+ gem "rspec", :git=>"https://github.com/rspec/rspec.git", :branch=>"master"
12
+ gem "rspec-core", :git=>"https://github.com/rspec/rspec-core.git", :branch=>"master"
13
+ gem "rspec-expectations", :git=>"https://github.com/rspec/rspec-expectations.git", :branch=>"master"
14
+ gem "rspec-mocks", :git=>"https://github.com/rspec/rspec-mocks.git", :branch=>"master"
15
+ gem "rspec-support", :git=>"https://github.com/rspec/rspec-support.git", :branch=>"master"
16
+
17
+ group :tools do
18
+ gem "guard"
19
+ gem "guard-rspec"
20
+ gem "byebug"
21
+ end
22
+
23
+ gemspec :path=>".././"
@@ -0,0 +1,23 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal", "1.0.0.beta2"
6
+ gem "simplecov", :require=>false
7
+ gem "coveralls", :require=>false
8
+ gem "activesupport", "4.1.0.beta1", :require=>"active_support/all"
9
+ gem "actionpack", "4.1.0.beta1", :require=>"action_controller"
10
+ gem "activerecord", "4.1.0.beta1", :require=>"active_record"
11
+ gem "actionview", "4.1.0.beta1", :require=>"action_view"
12
+ gem "rspec", "~> 2.14"
13
+ gem "rspec-core", "~> 2.14"
14
+ gem "rspec-expectations", "~> 2.14"
15
+ gem "rspec-mocks", "~> 2.14"
16
+
17
+ group :tools do
18
+ gem "guard"
19
+ gem "guard-rspec"
20
+ gem "byebug"
21
+ end
22
+
23
+ gemspec :path=>".././"
@@ -0,0 +1,23 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal", "1.0.0.beta2"
6
+ gem "simplecov", :require=>false
7
+ gem "coveralls", :require=>false
8
+ gem "activesupport", "4.1.0.beta1", :require=>"active_support/all"
9
+ gem "actionpack", "4.1.0.beta1", :require=>"action_controller"
10
+ gem "activerecord", "4.1.0.beta1", :require=>"active_record"
11
+ gem "actionview", "4.1.0.beta1", :require=>"action_view"
12
+ gem "rspec", "2.99.0.beta1"
13
+ gem "rspec-core", "2.99.0.beta1"
14
+ gem "rspec-expectations", "2.99.0.beta1"
15
+ gem "rspec-mocks", "2.99.0.beta1"
16
+
17
+ group :tools do
18
+ gem "guard"
19
+ gem "guard-rspec"
20
+ gem "byebug"
21
+ end
22
+
23
+ gemspec :path=>".././"
@@ -0,0 +1,24 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal", "1.0.0.beta2"
6
+ gem "simplecov", :require=>false
7
+ gem "coveralls", :require=>false
8
+ gem "activesupport", "4.1.0.beta1", :require=>"active_support/all"
9
+ gem "actionpack", "4.1.0.beta1", :require=>"action_controller"
10
+ gem "activerecord", "4.1.0.beta1", :require=>"active_record"
11
+ gem "actionview", "4.1.0.beta1", :require=>"action_view"
12
+ gem "rspec", "3.0.0.beta1"
13
+ gem "rspec-core", "3.0.0.beta1"
14
+ gem "rspec-expectations", "3.0.0.beta1"
15
+ gem "rspec-mocks", "3.0.0.beta1"
16
+ gem "rspec-support", "3.0.0.beta1"
17
+
18
+ group :tools do
19
+ gem "guard"
20
+ gem "guard-rspec"
21
+ gem "byebug"
22
+ end
23
+
24
+ gemspec :path=>".././"
@@ -0,0 +1,24 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal", "1.0.0.beta2"
6
+ gem "simplecov", :require=>false
7
+ gem "coveralls", :require=>false
8
+ gem "activesupport", "4.1.0.beta1", :require=>"active_support/all"
9
+ gem "actionpack", "4.1.0.beta1", :require=>"action_controller"
10
+ gem "activerecord", "4.1.0.beta1", :require=>"active_record"
11
+ gem "actionview", "4.1.0.beta1", :require=>"action_view"
12
+ gem "rspec", :git=>"https://github.com/rspec/rspec.git", :branch=>"master"
13
+ gem "rspec-core", :git=>"https://github.com/rspec/rspec-core.git", :branch=>"master"
14
+ gem "rspec-expectations", :git=>"https://github.com/rspec/rspec-expectations.git", :branch=>"master"
15
+ gem "rspec-mocks", :git=>"https://github.com/rspec/rspec-mocks.git", :branch=>"master"
16
+ gem "rspec-support", :git=>"https://github.com/rspec/rspec-support.git", :branch=>"master"
17
+
18
+ group :tools do
19
+ gem "guard"
20
+ gem "guard-rspec"
21
+ gem "byebug"
22
+ end
23
+
24
+ gemspec :path=>".././"
@@ -1,8 +1,6 @@
1
1
  module Warp
2
2
  module ControllerMatchers
3
- class AssignMatcher
4
- include RSpec::Matchers::Composable
5
-
3
+ class AssignMatcher < Warp::Matcher
6
4
  attr_reader :assign_key, :assign_with, :assign_with_a, :assign_with_a_new
7
5
  attr_reader :controller, :failure_message, :failure_message_when_negated, :description
8
6
 
@@ -1,8 +1,6 @@
1
1
  module Warp
2
2
  module ControllerMatchers
3
- class SetFlashMatcher
4
- include RSpec::Matchers::Composable
5
-
3
+ class SetFlashMatcher < Warp::Matcher
6
4
  attr_reader :flash_key, :expected_flash_value
7
5
  attr_reader :controller, :failure_message, :failure_message_when_negated, :description
8
6
 
@@ -19,21 +17,28 @@ module Warp
19
17
  def matches?(actual)
20
18
  @controller = actual if actual.is_a?(ActionController::Metal)
21
19
 
22
- if expected_flash_value
23
- @description = "set flash[:#{flash_key}] to #{expected_flash_value.inspect}"
24
- @failure_message = "expected flash[:#{flash_key}] to be set to #{expected_flash_value.inspect}"
25
- @failure_message_when_negated = "expected flash[:#{flash_key}] to not be set to #{expected_flash_value.inspect}"
26
- values_match?(expected_flash_value, flash_value)
27
- else
28
- @description = "set flash[:#{flash_key}]"
29
- @failure_message = "expected flash[:#{flash_key}] to be set"
30
- @failure_message_when_negated = "expected flash[:#{flash_key}] to not be set"
31
- values_match?(false, flash_value.nil?)
32
- end
20
+ return check_expected_value if expected_flash_value
21
+ return check_assigned
33
22
  end
34
23
 
35
24
  private
36
25
 
26
+ def check_expected_value
27
+ @description = "set flash[:#{flash_key}] to #{expected_flash_value.inspect}"
28
+ @failure_message = "expected flash[:#{flash_key}] to be set to #{expected_flash_value.inspect}"
29
+ @failure_message_when_negated = "expected flash[:#{flash_key}] to not be set to #{expected_flash_value.inspect}"
30
+
31
+ values_match?(expected_flash_value, flash_value)
32
+ end
33
+
34
+ def check_assigned
35
+ @description = "set flash[:#{flash_key}]"
36
+ @failure_message = "expected flash[:#{flash_key}] to be set"
37
+ @failure_message_when_negated = "expected flash[:#{flash_key}] to not be set"
38
+
39
+ values_match?(false, flash_value.nil?)
40
+ end
41
+
37
42
  def flash_value
38
43
  flash[flash_key]
39
44
  end