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.
@@ -16,7 +16,7 @@ module DealRedemptions
16
16
  end
17
17
 
18
18
  it 'sender' do
19
- expect(mail.from).to eq(["noreply@dealsiteredemptions.com"])
19
+ expect(mail.from).to eq(["noreply@domain.com"])
20
20
  end
21
21
  end
22
22
  end
@@ -16,7 +16,7 @@ module DealRedemptions
16
16
  end
17
17
 
18
18
  it 'sender' do
19
- expect(mail.from).to eq(["noreply@dealsiteredemptions.com"])
19
+ expect(mail.from).to eq(["noreply@domain.com"])
20
20
  end
21
21
  end
22
22
  end
@@ -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
- @rake = Rake::Application.new
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
- context 'deal_redemptions:install:config' do
13
- subject { @rake['deal_redemptions:install:config'] }
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
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-09 00:00:00.000000000 Z
11
+ date: 2014-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails