Sha256: 7d9e6e9e3f678aec45bba08c036d2a22d57d83ffc7ff6e5802730998121867c4

Contents?: true

Size: 1.38 KB

Versions: 7

Compression:

Stored size: 1.38 KB

Contents

require 'spec_helper'

describe "In the dashboard, Sites", type: :feature do

  it "creates a site" do
    login FactoryGirl.create(:user), true
    expect(Storytime::Site.count).to eq(0)

    visit new_dashboard_site_path

    fill_in "site_title", with: "The Site"
    fill_in "site_custom_domain", with: "example.lvh.me"
    fill_in "site_subscription_email_from", with: "test@example.com"

    click_button "Save"

    # since creating a site redirects you to a new domain, you are not logged in
    fill_in "user_email", with: current_user.email
    fill_in "user_password", with: current_user.password
    click_on "Log in"

    expect(page).to have_content("Pages")
    expect(Storytime::Site.count).to eq(1)

    site = Storytime::Site.last
    expect(site.title).to eq("The Site")
    expect(site.custom_domain).to eq("example.lvh.me")
    expect(site.subscription_email_from).to eq("test@example.com")
  end

  context "as a logged in user" do
    before{ login_admin }

    it "updates a site", js: true do
      site = Storytime::Site.last

      visit storytime.dashboard_path
      click_link "utility-menu-toggle"
      click_link "site-settings-link"
      fill_in "site_title", with: "The Site's New Name"
      click_button "Save"

      expect(page).to have_content("Your changes were saved successfully")
      site.reload
      expect(site.title).to eq "The Site's New Name"
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
storytime-2.1.6 spec/features/dashboard/sites_spec.rb
storytime-2.1.5 spec/features/dashboard/sites_spec.rb
storytime-2.1.4 spec/features/dashboard/sites_spec.rb
storytime-2.1.3 spec/features/dashboard/sites_spec.rb
storytime-2.1.2 spec/features/dashboard/sites_spec.rb
storytime-2.1.1 spec/features/dashboard/sites_spec.rb
storytime-2.1.0 spec/features/dashboard/sites_spec.rb