spec/features/subscription_spec.rb in storytime-1.2.0 vs spec/features/subscription_spec.rb in storytime-2.0.0
- old
+ new
@@ -1,10 +1,10 @@
require 'spec_helper'
describe "Subscriptions" do
before do
- setup_site
+ setup_site(FactoryGirl.create(:admin))
end
it "allows users to subscribe to a site" do
expect(Storytime::Subscription.count).to eq(0)
@@ -12,24 +12,24 @@
email_address = "some_email_address@example.com"
visit "/"
click_link "#{I18n.t('layout.subscribe_to', site_name: site.title)}"
fill_in "subscription_email", with: email_address
- click_button "Create Subscription"
+ click_button "Subscribe"
expect(Storytime::Subscription.count).to eq(1)
subscription = Storytime::Subscription.first
expect(subscription.email).to eq(email_address)
expect(subscription.token).to_not eq(nil)
expect(subscription.subscribed?).to eq(true)
end
it "only allows users to unsubscribe with a proper token" do
- subscription_1 = FactoryGirl.create(:subscription)
+ subscription_1 = FactoryGirl.create(:subscription, site: @current_site)
token_1 = subscription_1.token
- subscription_2 = FactoryGirl.create(:subscription)
+ subscription_2 = FactoryGirl.create(:subscription, site: @current_site)
token_2 = subscription_2.token
visit url_for([:unsubscribe_mailing_list, {:email => subscription_1.email, :t => token_2}])
expect(page).to have_content(I18n.t('flash.subscriptions.destroy.fail'))
\ No newline at end of file