Sha256: 7d9b4c61641250ef06e78c00c29af0900c451fb03ee920020f3d0a488109c16a

Contents?: true

Size: 1.12 KB

Versions: 8

Compression:

Stored size: 1.12 KB

Contents

require 'spec_helper'

describe "In the dashboard, Sites" do

  it "creates a site" do
    login FactoryGirl.create(:admin), true
    Storytime::Site.count.should == 0

    visit new_dashboard_site_path
    fill_in "site_title", with: "The Site"
    click_button "Create Site"
    
    page.should have_content(I18n.t('flash.sites.create.success'))
    Storytime::Site.count.should == 1

    page = Storytime::Site.last
    page.title.should == "The Site"
  end

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

    it "updates a site" do
      Storytime::Site.count.should == 1

      visit edit_dashboard_site_path(current_site)
      fill_in "site_title", with: "The Site's New Name"
      click_button "Update Site"
      
      page.should have_content(I18n.t('flash.sites.update.success'))
      Storytime::Site.count.should == 1

      s = Storytime::Site.last
      s.title.should == "The Site's New Name"
    end

    it "new redirects to edit if a site already exists" do
      visit new_dashboard_site_path
      page.should have_content("Site Settings")
      page.should have_content("Permissions")
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
storytime-1.2.0 spec/features/dashboard/sites_spec.rb
storytime-1.1.1 spec/features/dashboard/sites_spec.rb
storytime-1.0.7 spec/features/dashboard/sites_spec.rb
storytime-1.0.6 spec/features/dashboard/sites_spec.rb
storytime-1.0.5 spec/features/dashboard/sites_spec.rb
storytime-1.0.2 spec/features/dashboard/sites_spec.rb
storytime-1.0.1 spec/features/dashboard/sites_spec.rb
storytime-1.0.0 spec/features/dashboard/sites_spec.rb