fine_print 3.0.0 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,6 +2,10 @@ FactoryGirl.define do
2
2
  factory :fine_print_signature, class: FinePrint::Signature do
3
3
  association :contract, factory: [:fine_print_contract, :published]
4
4
 
5
+ trait :implicit do
6
+ is_implicit FinePrint::SIGNATURE_IS_IMPLICIT
7
+ end
8
+
5
9
  transient do
6
10
  user_factory :user
7
11
  end
@@ -9,5 +13,5 @@ FactoryGirl.define do
9
13
  after(:build) do |signature, evaluator|
10
14
  signature.user ||= FactoryGirl.build(evaluator.user_factory)
11
15
  end
12
- end
16
+ end
13
17
  end
@@ -9,7 +9,7 @@ describe FinePrint, type: :lib do
9
9
 
10
10
  @user = DummyUser.create
11
11
  @alpha_1_sig = FactoryGirl.create(:fine_print_signature, contract: @alpha_1,
12
- user: @user)
12
+ user: @user)
13
13
  @beta_1_sig = FactoryGirl.create(:fine_print_signature, contract: @beta_1,
14
14
  user: @user)
15
15
 
@@ -55,4 +55,16 @@ describe FinePrint, type: :lib do
55
55
  expect(FinePrint.signed_any_version_of_contract?(@user, @alpha_2)).to eq true
56
56
  expect(FinePrint.signed_any_version_of_contract?(@user, @beta_1)).to eq true
57
57
  end
58
+
59
+ it 'can record implicit signatures' do
60
+ signature = FinePrint.sign_contract(@user, @alpha_2,
61
+ FinePrint::SIGNATURE_IS_IMPLICIT)
62
+
63
+ expect(signature.is_implicit?).to eq true
64
+ expect(signature.is_explicit?).to eq false
65
+ end
66
+
67
+ it 'records signatures explicitly by default' do
68
+ expect(FinePrint.sign_contract(@user, @alpha_2).is_explicit?).to eq true
69
+ end
58
70
  end
@@ -67,5 +67,23 @@ module FinePrint
67
67
  new_version.publish
68
68
  expect(new_version.version).to eq 1
69
69
  end
70
+
71
+ it 'calls the contract_published_proc after publish' do
72
+ original_proc = FinePrint.config.contract_published_proc
73
+
74
+ begin
75
+ FinePrint.config.contract_published_proc = lambda do |contract|
76
+ contract.name = 'Deep Thought'
77
+ end
78
+ contract = FactoryGirl.create(:fine_print_contract, name: '42')
79
+ contract.publish
80
+ expect(contract.name).to eq 'Deep Thought'
81
+ rescue
82
+ fail
83
+ ensure
84
+ FinePrint.config.contract_published_proc = original_proc
85
+ end
86
+ end
87
+
70
88
  end
71
89
  end
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,8 @@
1
1
  ENV['RAILS_ENV'] ||= 'test'
2
2
 
3
+ require 'coveralls'
4
+ Coveralls.wear!('rails')
5
+
3
6
  require File.expand_path('../dummy/config/environment.rb', __FILE__)
4
7
  require 'rspec/rails'
5
8
  require 'factory_girl_rails'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fine_print
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - JP Slavinsky
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-03-25 00:00:00.000000000 Z
12
+ date: 2015-08-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -137,6 +137,20 @@ dependencies:
137
137
  - - ">="
138
138
  - !ruby/object:Gem::Version
139
139
  version: '0'
140
+ - !ruby/object:Gem::Dependency
141
+ name: coveralls
142
+ requirement: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ type: :development
148
+ prerelease: false
149
+ version_requirements: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - ">="
152
+ - !ruby/object:Gem::Version
153
+ version: '0'
140
154
  description: FinePrint allows site admins to easily create, update and ask users to
141
155
  sign site agreements, keeping a record of when users signed a certain version of
142
156
  each agreement.
@@ -170,6 +184,7 @@ files:
170
184
  - config/locales/fine_print/en.yml
171
185
  - config/routes.rb
172
186
  - db/migrate/0_install_fine_print.rb
187
+ - db/migrate/1_add_implicit_signatures.rb
173
188
  - lib/fine_print.rb
174
189
  - lib/fine_print/action_controller/base.rb
175
190
  - lib/fine_print/configuration.rb
@@ -209,7 +224,7 @@ files:
209
224
  - spec/dummy/config/initializers/wrap_parameters.rb
210
225
  - spec/dummy/config/locales/en.yml
211
226
  - spec/dummy/config/routes.rb
212
- - spec/dummy/db/migrate/1_create_dummy_users.rb
227
+ - spec/dummy/db/migrate/1000_create_dummy_users.rb
213
228
  - spec/dummy/db/schema.rb
214
229
  - spec/dummy/db/test.sqlite3
215
230
  - spec/dummy/log/test.log
@@ -282,7 +297,7 @@ test_files:
282
297
  - spec/dummy/config/locales/en.yml
283
298
  - spec/dummy/config/routes.rb
284
299
  - spec/dummy/config.ru
285
- - spec/dummy/db/migrate/1_create_dummy_users.rb
300
+ - spec/dummy/db/migrate/1000_create_dummy_users.rb
286
301
  - spec/dummy/db/schema.rb
287
302
  - spec/dummy/db/test.sqlite3
288
303
  - spec/dummy/log/test.log