Sha256: a475880eb5aafe502331be459bc1b04b5a312fd0f5e35cc18d1ebf62c2ca3805

Contents?: true

Size: 1.95 KB

Versions: 1

Compression:

Stored size: 1.95 KB

Contents

# require 'spec_helper'

# describe "In the dashboard, Subscriptions" do
#   before do
#     login_admin
#   end

#   it "lists subscriptions" do
#     3.times{ FactoryGirl.create(:subscription) }
#     visit url_for([:dashboard, Storytime::Subscription])

#     Storytime::Subscription.all.each do |s|
#       expect(page).to have_link("Edit", href: url_for([:edit, :dashboard, s]))  
#     end
#   end

#   it "creates a subscription" do
#     expect(Storytime::Subscription.count).to eq(0)

#     visit url_for([:new, :dashboard, :subscription, only_path: true])
#     fill_in "subscription_email", with: "some_random_email@example.com"

#     click_button "Create Subscription"

#     expect(page).to have_content(I18n.t('flash.subscriptions.create.success'))
#     expect(Storytime::Subscription.count).to eq(1)

#     subscription = Storytime::Subscription.last

#     expect(subscription.email).to eq("some_random_email@example.com")
#     expect(subscription.token).to_not eq(nil)
#   end

#   it "updates a subscription" do
#     subscription = FactoryGirl.create(:subscription)

#     expect(Storytime::Subscription.count).to eq(1)
#     expect(subscription.subscribed?).to eq(true)

#     visit url_for([:edit, :dashboard, subscription])
#     fill_in "subscription_email", with: "johndoe@example.com"
#     uncheck "subscription_subscribed"
#     click_button "Update Subscription"

#     expect(page).to have_content(I18n.t('flash.subscriptions.update.success'))

#     subscription.reload

#     expect(subscription.email).to eq("johndoe@example.com")
#     expect(subscription.subscribed?).to eq(false)
#   end

#   describe "unsubscribe link" do
#     it "unsubscribes an email address" do
#       subscription = FactoryGirl.create(:subscription)
#       token = subscription.token

#       visit url_for([:dashboard, :subscriptions, :unsubscribe, {:t => token}])

#       expect(page).to have_content(I18n.t('dashboard.subscriptions.unsubscribe.message'))
#     end
#   end
# end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
storytime-1.0.7 spec/features/dashboard/subscription_spec.rb