aws_tickwork 0.0.2 → 0.9.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.
@@ -1 +1 @@
1
- o: ActiveSupport::Cache::Entry: @valuei:@created_atf1462854871.302891:@expires_in0
1
+ o: ActiveSupport::Cache::Entry: @valuei:@created_atf1462923425.2437382:@expires_in0
@@ -0,0 +1 @@
1
+ 97815
@@ -0,0 +1,53 @@
1
+ require 'rails_helper'
2
+
3
+ describe AwsTickwork::Engine do
4
+ before { AwsTickwork::Engine.clear! }
5
+ it "has good defauls" do
6
+ AwsTickwork::Engine.https_only.should == false
7
+ AwsTickwork::Engine.http_username.should == nil
8
+ AwsTickwork::Engine.http_password.should == nil
9
+ AwsTickwork::Engine.enable_authenticate.should == true
10
+ end
11
+
12
+ it "can be configured" do
13
+ AwsTickwork::Engine.setup do |c|
14
+ c.https_only = true
15
+ c.http_username = "john"
16
+ c.http_password = "password"
17
+ c.enable_authenticate = false
18
+ end
19
+ AwsTickwork::Engine.https_only.should == true
20
+ AwsTickwork::Engine.http_username.should == "john"
21
+ AwsTickwork::Engine.http_password.should == "password"
22
+ AwsTickwork::Engine.enable_authenticate.should == false
23
+ end
24
+
25
+ it "username required if password supplied" do
26
+ expect {
27
+ AwsTickwork::Engine.setup do |c|
28
+ c.https_only = true
29
+ c.http_password = "password"
30
+ end
31
+ }.to raise_error AwsTickwork::Engine::ValidationError
32
+ end
33
+
34
+ it "password required if username supplied" do
35
+ expect {
36
+ AwsTickwork::Engine.setup do |c|
37
+ c.https_only = true
38
+ c.http_username = "john"
39
+ end
40
+ }.to raise_error AwsTickwork::Engine::ValidationError
41
+ end
42
+
43
+ it "refuses to send passwords in the clear" do
44
+ expect {
45
+ AwsTickwork::Engine.setup do |c|
46
+ c.https_only = false
47
+ c.http_username = "john"
48
+ c.http_password = "password"
49
+ end
50
+ }.to raise_error AwsTickwork::Engine::ValidationError
51
+ end
52
+
53
+ end
@@ -2,8 +2,11 @@
2
2
  require 'rails_helper'
3
3
 
4
4
  RSpec.describe "SNS driving tickwork events", type: :request do
5
- let (:sample_notification) do
6
- sample = <<-END
5
+ before do
6
+ allow_any_instance_of(Aws::SNS::MessageVerifier).to receive(:authenticate!)
7
+ allow_any_instance_of(Aws::SNS::MessageVerifier).to receive(:authentic?).and_return(true)
8
+ end
9
+ let (:sample_notification) { <<-END.squish }
7
10
  {
8
11
  "Type" : "Notification",
9
12
  "MessageId" : "36313258-6c80-508f-a5ae-7df1cb7989f4",
@@ -16,14 +19,11 @@ RSpec.describe "SNS driving tickwork events", type: :request do
16
19
  "UnsubscribeURL" : "https://sns.us-east-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-east-1:372178782529:Lancaster-Staging:44d97b9e-a40f-4a82-9077-ba24faec9227"
17
20
  }
18
21
  END
19
- sample.squish
20
- end
21
22
  it "causes a job to run" do
22
23
  Rails.cache.write('tickwork_testing', 0)
23
- post "/aws_tickwork/sns_endpoint/notify", sample_notification
24
+ post "/aws_tickwork/sns_endpoint/notify", sample_notification, {"HTTP_X_AMZ_SNS_MESSAGE_TYPE" => "Notification"}
24
25
  response.should be_ok
25
26
  Rails.cache.read('tickwork_testing').should == 1
26
-
27
27
  end
28
28
 
29
29
  end
@@ -43,6 +43,10 @@ RSpec.configure do |config|
43
43
 
44
44
  config.expect_with(:rspec) { |c| c.syntax = [:expect, :should] }
45
45
 
46
+ config.before(:each) do
47
+ AwsTickwork::Engine.clear!
48
+ end
49
+
46
50
  # The settings below are suggested to provide a good initial experience
47
51
  # with RSpec, but feel free to customize to your heart's content.
48
52
  =begin
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws_tickwork
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Hinnegan
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: aws-sdk
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '2'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '2'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: sqlite3
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -180,6 +194,7 @@ files:
180
194
  - spec/dummy/config/environments/production.rb
181
195
  - spec/dummy/config/environments/test.rb
182
196
  - spec/dummy/config/initializers/assets.rb
197
+ - spec/dummy/config/initializers/aws_tickwork.rb
183
198
  - spec/dummy/config/initializers/backtrace_silencers.rb
184
199
  - spec/dummy/config/initializers/cookies_serializer.rb
185
200
  - spec/dummy/config/initializers/filter_parameter_logging.rb
@@ -191,6 +206,7 @@ files:
191
206
  - spec/dummy/config/locales/en.yml
192
207
  - spec/dummy/config/routes.rb
193
208
  - spec/dummy/config/secrets.yml
209
+ - spec/dummy/db/development.sqlite3
194
210
  - spec/dummy/db/schema.rb
195
211
  - spec/dummy/db/test.sqlite3
196
212
  - spec/dummy/log/development.log
@@ -201,6 +217,8 @@ files:
201
217
  - spec/dummy/public/favicon.ico
202
218
  - spec/dummy/tmp/cache/14A/870/key
203
219
  - spec/dummy/tmp/cache/6CC/EF0/tickwork_testing
220
+ - spec/dummy/tmp/pids/server.pid
221
+ - spec/engine_spec.rb
204
222
  - spec/factories/aws_tickwork_db_data_stores.rb
205
223
  - spec/models/aws_tickwork/db_data_store_spec.rb
206
224
  - spec/rails_helper.rb
@@ -249,6 +267,7 @@ test_files:
249
267
  - spec/dummy/config/environments/production.rb
250
268
  - spec/dummy/config/environments/test.rb
251
269
  - spec/dummy/config/initializers/assets.rb
270
+ - spec/dummy/config/initializers/aws_tickwork.rb
252
271
  - spec/dummy/config/initializers/backtrace_silencers.rb
253
272
  - spec/dummy/config/initializers/cookies_serializer.rb
254
273
  - spec/dummy/config/initializers/filter_parameter_logging.rb
@@ -261,6 +280,7 @@ test_files:
261
280
  - spec/dummy/config/routes.rb
262
281
  - spec/dummy/config/secrets.yml
263
282
  - spec/dummy/config.ru
283
+ - spec/dummy/db/development.sqlite3
264
284
  - spec/dummy/db/schema.rb
265
285
  - spec/dummy/db/test.sqlite3
266
286
  - spec/dummy/log/development.log
@@ -273,6 +293,8 @@ test_files:
273
293
  - spec/dummy/README.rdoc
274
294
  - spec/dummy/tmp/cache/14A/870/key
275
295
  - spec/dummy/tmp/cache/6CC/EF0/tickwork_testing
296
+ - spec/dummy/tmp/pids/server.pid
297
+ - spec/engine_spec.rb
276
298
  - spec/factories/aws_tickwork_db_data_stores.rb
277
299
  - spec/models/aws_tickwork/db_data_store_spec.rb
278
300
  - spec/rails_helper.rb