warp 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
YTMzNzFhMGE3YTcwYzRhNDcwY2Q1ZThmODE1NzFlOGQ2YjNjMDVmYQ==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f6cbf9ef52e08774d01f175a2332feeb01860963
|
4
|
+
data.tar.gz: 30b1477e764a15f0bf98fff122558e7adbd9a4c6
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
M2Y5ZGRkN2M5N2I0Nzg5ZTAwNjJlZjg4YjAxNjAwY2ZiYTZjMDk2MWQ5ZmE0
|
11
|
-
NDAwOTdiYjlkNDYyMWU4MjBlM2NhYzZiNDU3NmVhNTRlMmVmMjM=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
ZDI5NGY0NGNmMWU2MmExMTE5MmUwZjYyZTFmYTUxMDkwYmFlMGM4NWI1OTMx
|
14
|
-
OWIzZjkwMjNkMjgzMWFhZTI5NmFhZDUxNWJlMzQ3OTEzNDk1NTUzOTJjNDk1
|
15
|
-
ZjFhN2RkOWVjNmE0ZWJlODY1MGQ4NmIzYjc1MGYxZWFhZDkyM2M=
|
6
|
+
metadata.gz: 451e896e044e7c5cd8f22f1f766c7f338eaf7f5826e27d2e65dbe7344eda07ec75a261ecdd1f89dc35048439b039e00e732c992545555f527a6e98f168433792
|
7
|
+
data.tar.gz: 44f2d8b79a1fc65ee0a8bde854ed658b7db548dd0e1e0396968a2ab27933ad5dd029f1785d807332f870678e0530d522079de5f09d3f9ce3d73fecd84c23c24a
|
data/lib/warp/instrument.rb
CHANGED
data/lib/warp/version.rb
CHANGED
@@ -25,8 +25,13 @@ module ModelHelpers
|
|
25
25
|
columns.any? {|c| c.name == method }
|
26
26
|
end
|
27
27
|
|
28
|
-
def self.column(name, sql_type =
|
29
|
-
|
28
|
+
def self.column(name, sql_type = "varchar(255)", default = nil, null = true)
|
29
|
+
if ActiveRecord::ConnectionAdapters::AbstractAdapter.method_defined?(:lookup_cast_type)
|
30
|
+
cast_type = ActiveRecord::ConnectionAdapters::AbstractAdapter.new(nil, nil, nil).lookup_cast_type(sql_type)
|
31
|
+
columns << ActiveRecord::ConnectionAdapters::Column.new(name.to_s, default, cast_type, sql_type.to_s, null)
|
32
|
+
else
|
33
|
+
columns << ActiveRecord::ConnectionAdapters::Column.new(name.to_s, default, sql_type.to_s, null)
|
34
|
+
end
|
30
35
|
end
|
31
36
|
|
32
37
|
instance_eval(&blk) if blk
|
@@ -1,20 +1,38 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe Warp::ActionMatchers::CreateMatcher do
|
4
|
-
build_model
|
4
|
+
build_model do
|
5
|
+
column :foo
|
6
|
+
|
7
|
+
validates :foo, presence: true
|
8
|
+
end
|
9
|
+
|
10
|
+
before { Warp::Instrument.for(model, Warp::ActionMatchers::CreateMatcher::CREATE_METHOD).calls << Object.new }
|
5
11
|
|
6
12
|
subject { create(model) }
|
7
13
|
|
8
|
-
|
9
|
-
|
14
|
+
with_contexts do
|
15
|
+
context "when created with #create" do
|
16
|
+
let(:block) { -> { model.create(params) } }
|
17
|
+
end
|
10
18
|
|
11
|
-
|
12
|
-
|
19
|
+
context "when created with #save" do
|
20
|
+
let(:block) { -> { model.new(params).save } }
|
21
|
+
end
|
22
|
+
|
23
|
+
behaviour do
|
24
|
+
context "with a valid record" do
|
25
|
+
let(:params) { {foo: "bar"} }
|
13
26
|
|
14
|
-
|
15
|
-
|
27
|
+
specify { expect(subject).to match block }
|
28
|
+
end
|
16
29
|
|
17
|
-
|
30
|
+
context "with an invalid record" do
|
31
|
+
let(:params) { {} }
|
32
|
+
|
33
|
+
specify { expect(subject).to_not match block }
|
34
|
+
end
|
35
|
+
end
|
18
36
|
end
|
19
37
|
|
20
38
|
context "when nothing created" do
|
@@ -24,6 +24,14 @@ describe Warp::Instrument do
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
+
describe "#reset" do
|
28
|
+
before { instrument.calls << Object.new }
|
29
|
+
|
30
|
+
subject { instrument.reset }
|
31
|
+
|
32
|
+
specify { expect{subject}.to change{instrument.calls}.to([]) }
|
33
|
+
end
|
34
|
+
|
27
35
|
describe "#run" do
|
28
36
|
specify { expect{|blk| instrument.run(&blk) }.to yield_control }
|
29
37
|
end
|
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: warp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
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-12-
|
11
|
+
date: 2014-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 2.14.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 2.14.0
|
27
27
|
description: Warp provides a selection of inteligent RSpec matchers for your model,
|
@@ -32,11 +32,11 @@ executables: []
|
|
32
32
|
extensions: []
|
33
33
|
extra_rdoc_files: []
|
34
34
|
files:
|
35
|
-
- .gitignore
|
36
|
-
- .rspec
|
37
|
-
- .ruby-gemset
|
38
|
-
- .ruby-version
|
39
|
-
- .travis.yml
|
35
|
+
- ".gitignore"
|
36
|
+
- ".rspec"
|
37
|
+
- ".ruby-gemset"
|
38
|
+
- ".ruby-version"
|
39
|
+
- ".travis.yml"
|
40
40
|
- Appraisals
|
41
41
|
- CHANGELOG.md
|
42
42
|
- Gemfile
|
@@ -96,12 +96,12 @@ require_paths:
|
|
96
96
|
- lib
|
97
97
|
required_ruby_version: !ruby/object:Gem::Requirement
|
98
98
|
requirements:
|
99
|
-
- -
|
99
|
+
- - ">="
|
100
100
|
- !ruby/object:Gem::Version
|
101
101
|
version: '0'
|
102
102
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
103
|
requirements:
|
104
|
-
- -
|
104
|
+
- - ">="
|
105
105
|
- !ruby/object:Gem::Version
|
106
106
|
version: '0'
|
107
107
|
requirements: []
|