deal_redemptions 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/mailers/deal_redemptions/admin_user_mailer.rb +1 -1
- data/app/mailers/deal_redemptions/redemption_mailer.rb +1 -1
- data/app/models/deal_redemptions/company.rb +1 -1
- data/app/views/deal_redemptions/redemption_mailer/confirmation.html.erb +1 -1
- data/app/views/layouts/deal_redemptions/application.html.erb +2 -1
- data/config/config_engine_rake_file.rb +6 -0
- data/lib/deal_redemptions/engine.rb +4 -0
- data/lib/deal_redemptions/version.rb +1 -1
- data/lib/tasks/deal_redemptions_tasks.rake +22 -0
- data/spec/dummy/config/initializers/deal_redemptions.rb +6 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +9 -0
- data/spec/dummy/log/test.log +23867 -0
- data/spec/mailers/deal_redemptions/admin_user_mailer_spec.rb +1 -1
- data/spec/mailers/deal_redemptions/redemption_mailer_spec.rb +1 -1
- data/spec/tasks/tasks_spec.rb +28 -4
- metadata +2 -2
data/spec/tasks/tasks_spec.rb
CHANGED
@@ -2,19 +2,43 @@ require 'rails_helper'
|
|
2
2
|
require 'rake'
|
3
3
|
|
4
4
|
describe 'deal redemption tasks' do
|
5
|
+
let(:rake) { Rake::Application.new }
|
6
|
+
let(:user) { FactoryGirl.build(:user) }
|
7
|
+
let(:valid_args) { {:first_name=>"Example", :last_name=>"User", :email=>"sample-user@dealsiteredemptions.com", :password=>"password"} }
|
8
|
+
let(:unvalid_args) { {:first_name=>"Example", :last_name=>"User", :email=>"ewfewf", :password=>"password"} }
|
9
|
+
|
5
10
|
before :each do
|
6
|
-
|
7
|
-
Rake.application = @rake
|
11
|
+
Rake.application = rake
|
8
12
|
DealRedemptions::Engine.load_tasks
|
9
13
|
Rake::Task.define_task(:environment)
|
10
14
|
end
|
11
15
|
|
12
|
-
|
13
|
-
subject {
|
16
|
+
describe 'deal_redemptions:install:config' do
|
17
|
+
subject { rake['deal_redemptions:install:config'] }
|
14
18
|
|
15
19
|
it 'generates config file in destination' do
|
16
20
|
subject.invoke
|
17
21
|
expect(File.exists?("#{Rails.root}/config/initializers/deal_redemptions.rb")).to eq(true)
|
18
22
|
end
|
19
23
|
end
|
24
|
+
|
25
|
+
describe 'deal_redemptions:install:admin' do
|
26
|
+
subject { rake['deal_redemptions:install:admin'] }
|
27
|
+
|
28
|
+
context 'generates admin user' do
|
29
|
+
it 'successful message' do
|
30
|
+
allow(DealRedemptions::User).to receive(:find_by_email).and_return(nil)
|
31
|
+
expect(STDOUT).to receive(:puts).with('Admin user was created. Email: sample-user@dealsiteredemptions.com, Password: password')
|
32
|
+
subject.invoke
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
context 'already generated admin user' do
|
37
|
+
it 'outputs admin already exists' do
|
38
|
+
allow(DealRedemptions::User).to receive(:find_by_email).and_return(user)
|
39
|
+
expect(STDOUT).to receive(:puts).with('Admin user already exists. Email: sample-user@dealsiteredemptions.com, Password: password')
|
40
|
+
subject.invoke
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
20
44
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deal_redemptions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Allan Cutler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|