wblog/spec/controllers/subscribes_controller_spec.rb

19 lines
512 B
Ruby
Raw Permalink Normal View History

require 'rails_helper'
2014-04-02 23:40:05 +08:00
RSpec.describe SubscribesController, type: :controller do
2014-04-02 23:40:05 +08:00
describe "POST 'create'" do
it "post ok" do
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)
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