2016-08-07 00:44:11 +08:00
|
|
|
require 'rails_helper'
|
2014-04-02 23:40:05 +08:00
|
|
|
|
2016-08-07 00:44:11 +08:00
|
|
|
RSpec.describe SubscribesController, type: :controller do
|
2014-04-02 23:40:05 +08:00
|
|
|
|
|
|
|
describe "POST 'create'" do
|
|
|
|
it "post ok" do
|
2016-08-07 00:44:11 +08:00
|
|
|
post 'create', params: { subscribe: { email: 'tester@test.com' } }
|
2014-04-02 23:40:05 +08:00
|
|
|
expect(Subscribe.all.size).to eq(1)
|
|
|
|
end
|
|
|
|
|
|
|
|
it "post with disabled email" do
|
2014-04-03 16:49:59 +08:00
|
|
|
subscribe = Subscribe.create(email: 'tester@test.com', enable: false)
|
2016-08-07 00:44:11 +08:00
|
|
|
post :create, params: { subscribe: { email: 'tester@test.com' } }
|
2014-07-21 14:51:21 +08:00
|
|
|
expect(subscribe.reload.enable).to be_truthy
|
2014-04-02 23:40:05 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|