warp 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rspec +3 -0
- data/.travis.yml +35 -8
- data/Appraisals +67 -0
- data/Gemfile +4 -5
- data/README.md +57 -8
- data/Rakefile +4 -1
- data/gemfiles/rails_3.2_rspec_2.14.gemfile +22 -0
- data/gemfiles/rails_3.2_rspec_2.99.0.beta1.gemfile +22 -0
- data/gemfiles/rails_3.2_rspec_3.0.0.beta1.gemfile +23 -0
- data/gemfiles/rails_3.2_rspec_master.gemfile +23 -0
- data/gemfiles/rails_4.0_rspec_2.14.gemfile +22 -0
- data/gemfiles/rails_4.0_rspec_2.99.0.beta1.gemfile +22 -0
- data/gemfiles/rails_4.0_rspec_3.0.0.beta1.gemfile +23 -0
- data/gemfiles/rails_4.0_rspec_master.gemfile +23 -0
- data/gemfiles/rails_4.1.0.beta1_rspec_2.14.gemfile +23 -0
- data/gemfiles/rails_4.1.0.beta1_rspec_2.99.0.beta1.gemfile +23 -0
- data/gemfiles/rails_4.1.0.beta1_rspec_3.0.0.beta1.gemfile +24 -0
- data/gemfiles/rails_4.1.0.beta1_rspec_master.gemfile +24 -0
- data/lib/warp/controller_matchers/assign_matcher.rb +1 -3
- data/lib/warp/controller_matchers/set_flash_matcher.rb +19 -14
- data/lib/warp/matcher.rb +30 -0
- data/lib/warp/model_matchers/association_matcher.rb +56 -0
- data/lib/warp/model_matchers/attribute_matcher.rb +32 -0
- data/lib/warp/model_matchers/error_matcher.rb +12 -0
- data/lib/warp/model_matchers/matcher.rb +15 -0
- data/lib/warp/model_matchers/validation_matcher.rb +12 -0
- data/lib/warp/model_matchers.rb +10 -0
- data/lib/warp/version.rb +13 -1
- data/lib/warp.rb +4 -1
- data/spec/spec_helper.rb +15 -6
- data/spec/support/failure_message_helpers.rb +23 -0
- data/spec/support/match_helpers.rb +24 -12
- data/spec/support/model_helpers.rb +25 -0
- data/spec/support/with_contexts_helpers.rb +6 -0
- data/spec/warp/controller_matchers/assign_matcher_spec.rb +35 -33
- data/spec/warp/controller_matchers/set_flash_matcher_spec.rb +4 -12
- data/spec/warp/model_helpers/association_matcher_spec.rb +102 -0
- data/spec/warp/model_helpers/attribute_matcher_spec.rb +43 -0
- data/warp.gemspec +2 -4
- metadata +31 -33
- data/gemfiles/rails-3.2 +0 -17
- data/gemfiles/rails-4.0 +0 -17
- data/gemfiles/rails-4.1 +0 -18
@@ -0,0 +1,43 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Warp::ModelMatchers::AttributeMatcher do
|
4
|
+
build_model do
|
5
|
+
column :foo
|
6
|
+
end
|
7
|
+
|
8
|
+
with_contexts do
|
9
|
+
context "with model" do
|
10
|
+
let(:model_or_instance) { model }
|
11
|
+
end
|
12
|
+
|
13
|
+
context "with model instance" do
|
14
|
+
let(:model_or_instance) { model.new }
|
15
|
+
end
|
16
|
+
|
17
|
+
behaviour do
|
18
|
+
let(:matcher) { have_attribute(attr_name) }
|
19
|
+
|
20
|
+
subject { matcher.tap {|m| m.matches?(model_or_instance) } }
|
21
|
+
|
22
|
+
context "and the attribute exists" do
|
23
|
+
let(:attr_name) { :foo }
|
24
|
+
|
25
|
+
specify { expect(subject).to match(model_or_instance) }
|
26
|
+
|
27
|
+
describe_failure_message_when_negated do
|
28
|
+
specify { expect(subject).to eq "expected to not have attribute :#{attr_name}" }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context "and the attribute does not exist" do
|
33
|
+
let(:attr_name) { :bar }
|
34
|
+
|
35
|
+
specify { expect(subject).to_not match(model_or_instance) }
|
36
|
+
|
37
|
+
describe_failure_message do
|
38
|
+
specify { expect(subject).to eq "expected to have attribute :#{attr_name}" }
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
data/warp.gemspec
CHANGED
@@ -18,12 +18,10 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(spec)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
#
|
21
|
+
# TODO: When RSpec 3 is released.
|
22
|
+
# spec.add_runtime_dependency "rspec", "~> 3.0.0"
|
22
23
|
|
23
24
|
spec.add_development_dependency "bundler", "~> 1.5.1"
|
24
25
|
spec.add_development_dependency "rake"
|
25
26
|
spec.add_development_dependency "fuubar"
|
26
|
-
|
27
|
-
spec.add_development_dependency "activesupport"
|
28
|
-
spec.add_development_dependency "actionpack"
|
29
27
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: warp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Drake-Brockman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,34 +52,6 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: activesupport
|
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
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: actionpack
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
55
|
description: Rails matchers for your RSpec specs.
|
84
56
|
email:
|
85
57
|
- thom@sfedb.com
|
@@ -88,29 +60,51 @@ extensions: []
|
|
88
60
|
extra_rdoc_files: []
|
89
61
|
files:
|
90
62
|
- ".gitignore"
|
63
|
+
- ".rspec"
|
91
64
|
- ".ruby-gemset"
|
92
65
|
- ".ruby-version"
|
93
66
|
- ".travis.yml"
|
67
|
+
- Appraisals
|
94
68
|
- CHANGELOG.md
|
95
69
|
- Gemfile
|
96
70
|
- Guardfile
|
97
71
|
- LICENSE
|
98
72
|
- README.md
|
99
73
|
- Rakefile
|
100
|
-
- gemfiles/
|
101
|
-
- gemfiles/
|
102
|
-
- gemfiles/
|
74
|
+
- gemfiles/rails_3.2_rspec_2.14.gemfile
|
75
|
+
- gemfiles/rails_3.2_rspec_2.99.0.beta1.gemfile
|
76
|
+
- gemfiles/rails_3.2_rspec_3.0.0.beta1.gemfile
|
77
|
+
- gemfiles/rails_3.2_rspec_master.gemfile
|
78
|
+
- gemfiles/rails_4.0_rspec_2.14.gemfile
|
79
|
+
- gemfiles/rails_4.0_rspec_2.99.0.beta1.gemfile
|
80
|
+
- gemfiles/rails_4.0_rspec_3.0.0.beta1.gemfile
|
81
|
+
- gemfiles/rails_4.0_rspec_master.gemfile
|
82
|
+
- gemfiles/rails_4.1.0.beta1_rspec_2.14.gemfile
|
83
|
+
- gemfiles/rails_4.1.0.beta1_rspec_2.99.0.beta1.gemfile
|
84
|
+
- gemfiles/rails_4.1.0.beta1_rspec_3.0.0.beta1.gemfile
|
85
|
+
- gemfiles/rails_4.1.0.beta1_rspec_master.gemfile
|
103
86
|
- lib/warp.rb
|
104
87
|
- lib/warp/controller_matchers.rb
|
105
88
|
- lib/warp/controller_matchers/assign_matcher.rb
|
106
89
|
- lib/warp/controller_matchers/set_flash_matcher.rb
|
90
|
+
- lib/warp/matcher.rb
|
91
|
+
- lib/warp/model_matchers.rb
|
92
|
+
- lib/warp/model_matchers/association_matcher.rb
|
93
|
+
- lib/warp/model_matchers/attribute_matcher.rb
|
94
|
+
- lib/warp/model_matchers/error_matcher.rb
|
95
|
+
- lib/warp/model_matchers/matcher.rb
|
96
|
+
- lib/warp/model_matchers/validation_matcher.rb
|
107
97
|
- lib/warp/version.rb
|
108
98
|
- spec/spec_helper.rb
|
109
99
|
- spec/support/controller_helpers.rb
|
100
|
+
- spec/support/failure_message_helpers.rb
|
110
101
|
- spec/support/match_helpers.rb
|
102
|
+
- spec/support/model_helpers.rb
|
111
103
|
- spec/support/with_contexts_helpers.rb
|
112
104
|
- spec/warp/controller_matchers/assign_matcher_spec.rb
|
113
105
|
- spec/warp/controller_matchers/set_flash_matcher_spec.rb
|
106
|
+
- spec/warp/model_helpers/association_matcher_spec.rb
|
107
|
+
- spec/warp/model_helpers/attribute_matcher_spec.rb
|
114
108
|
- warp.gemspec
|
115
109
|
homepage: ''
|
116
110
|
licenses:
|
@@ -139,7 +133,11 @@ summary: Warp provides matchers for testing your Rails application with RSpec.
|
|
139
133
|
test_files:
|
140
134
|
- spec/spec_helper.rb
|
141
135
|
- spec/support/controller_helpers.rb
|
136
|
+
- spec/support/failure_message_helpers.rb
|
142
137
|
- spec/support/match_helpers.rb
|
138
|
+
- spec/support/model_helpers.rb
|
143
139
|
- spec/support/with_contexts_helpers.rb
|
144
140
|
- spec/warp/controller_matchers/assign_matcher_spec.rb
|
145
141
|
- spec/warp/controller_matchers/set_flash_matcher_spec.rb
|
142
|
+
- spec/warp/model_helpers/association_matcher_spec.rb
|
143
|
+
- spec/warp/model_helpers/attribute_matcher_spec.rb
|
data/gemfiles/rails-3.2
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
gem "warp", :path=>"../"
|
4
|
-
|
5
|
-
gem "bundler", "~> 1.5.1"
|
6
|
-
gem "rake"
|
7
|
-
|
8
|
-
gem "activesupport", "~> 3.2"
|
9
|
-
gem "actionpack", "~> 3.2"
|
10
|
-
|
11
|
-
gem "rspec", git: "https://github.com/rspec/rspec.git"
|
12
|
-
gem "rspec-core", git: "https://github.com/rspec/rspec-core.git"
|
13
|
-
gem "rspec-expectations", git: "https://github.com/rspec/rspec-expectations.git"
|
14
|
-
gem "rspec-mocks", git: "https://github.com/rspec/rspec-mocks.git"
|
15
|
-
gem "rspec-support", git: "https://github.com/rspec/rspec-support.git"
|
16
|
-
|
17
|
-
gem "fuubar"
|
data/gemfiles/rails-4.0
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
gem "warp", :path=>"../"
|
4
|
-
|
5
|
-
gem "bundler", "~> 1.5.1"
|
6
|
-
gem "rake"
|
7
|
-
|
8
|
-
gem "activesupport", "~> 4.0"
|
9
|
-
gem "actionpack", "~> 4.0"
|
10
|
-
|
11
|
-
gem "rspec", git: "https://github.com/rspec/rspec.git"
|
12
|
-
gem "rspec-core", git: "https://github.com/rspec/rspec-core.git"
|
13
|
-
gem "rspec-expectations", git: "https://github.com/rspec/rspec-expectations.git"
|
14
|
-
gem "rspec-mocks", git: "https://github.com/rspec/rspec-mocks.git"
|
15
|
-
gem "rspec-support", git: "https://github.com/rspec/rspec-support.git"
|
16
|
-
|
17
|
-
gem "fuubar"
|
data/gemfiles/rails-4.1
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
gem "warp", :path=>"../"
|
4
|
-
|
5
|
-
gem "bundler", "~> 1.5.1"
|
6
|
-
gem "rake"
|
7
|
-
|
8
|
-
gem "activesupport", "4.1.0.beta1"
|
9
|
-
gem "actionpack", "4.1.0.beta1"
|
10
|
-
gem "actionview", "4.1.0.beta1", require: "action_view"
|
11
|
-
|
12
|
-
gem "rspec", git: "https://github.com/rspec/rspec.git"
|
13
|
-
gem "rspec-core", git: "https://github.com/rspec/rspec-core.git"
|
14
|
-
gem "rspec-expectations", git: "https://github.com/rspec/rspec-expectations.git"
|
15
|
-
gem "rspec-mocks", git: "https://github.com/rspec/rspec-mocks.git"
|
16
|
-
gem "rspec-support", git: "https://github.com/rspec/rspec-support.git"
|
17
|
-
|
18
|
-
gem "fuubar"
|