spec/models/contactology/campaigns/transactional_spec.rb in contactology-0.1.2 vs spec/models/contactology/campaigns/transactional_spec.rb in contactology-1.0.0

- old
+ new

@@ -2,40 +2,51 @@ require 'spec_helper' describe Contactology::Campaigns::Transactional do context '.create' do - context 'when successful' do - use_vcr_cassette 'campaigns/transactional/create/success' - let(:campaign) { Contactology::Campaigns::Transactional.create Factory.attributes_for(:transactional_campaign) } + context 'when successful', :vcr => {:cassette_name => 'campaigns/transactional/create/success'} do + let(:campaign) { Contactology::Campaigns::Transactional.create attributes_for(:transactional_campaign) } after(:each) { campaign.destroy } subject { campaign } it { should be_instance_of Contactology::Campaigns::Transactional } its(:id) { should_not be_nil } its(:object_id) { should == campaign.object_id } end - context 'when unsuccessful' do - use_vcr_cassette 'campaigns/transactional/create/failure' - let(:campaign) { Contactology::Campaigns::Transactional.create Factory.attributes_for(:transactional_campaign).merge(:content => {:text => 'bad'}) } + context 'when unsuccessful', :vcr => {:cassette_name => 'campaigns/transactional/create/failure'} do + let(:campaign) { Contactology::Campaigns::Transactional.create attributes_for(:transactional_campaign).merge(:content => {:text => 'bad'}) } subject { campaign } - it { should be_kind_of Contactology::SendResult } - it { should_not be_successful } - its(:issues) { should_not be_empty } + it 'returns a Contactology::SendResult' do + pending('This is incorrectly passing successfully on Contactology.') do + should be_kind_of Contactology::SendResult + end + end + + it 'should not be successful' do + pending('This is incorrectly passing successfully on Contactology.') do + should_not be_successful + end + end + + it 'should contain issues' do + pending('This is incorrectly passing successfully on Contactology.') do + subject.issues.should_not be_empty + end + end end end context '#send_campaign' do - context 'when successful' do - use_vcr_cassette 'campaigns/transactional/send_campaign/success' - let(:contact) { Factory :contact } - let(:campaign) { Factory :transactional_campaign } + context 'when successful', :vcr => {:cassette_name => 'campaigns/transactional/send_campaign/success'} do + let(:contact) { create :contact } + let(:campaign) { create :transactional_campaign } after(:each) do campaign.destroy contact.destroy end @@ -45,12 +56,11 @@ it { should be_instance_of Contactology::SendResult } it { should be_successful } its(:issues) { should be_empty } end - context 'when unsuccessful' do - use_vcr_cassette 'campaigns/transactional/send_campaign/failure'#, record: :new_episodes - let(:campaign) { Factory :transactional_campaign } + context 'when unsuccessful', :vcr => {:cassette_name => 'campaigns/transactional/send_campaign/failure'} do + let(:campaign) { create :transactional_campaign } after(:each) { campaign.destroy } subject { campaign.send_campaign(Struct.new(:email).new('bad')) } it { should be_kind_of Contactology::SendResult }