Sha256: d615bd12777722377b9fe1e83a3e6d59a6b434977f41284e1e1ec5ac4e92b9db

Contents?: true

Size: 1.53 KB

Versions: 3

Compression:

Stored size: 1.53 KB

Contents

require "spec_helper"

module Refinery
  module Admin
    describe "Settings" do
      login_refinery_user

      context "when no settings" do
        before(:each) { Refinery::Setting.destroy_all }

        it "invites to create one" do
          visit refinery.admin_settings_path
          page.should have_content("There are no settings yet. Click 'Add new setting' to add your first setting.")
        end
      end

      it "shows add new setting link" do
        visit refinery.admin_settings_path
        page.should have_content("Add new setting")
        page.should have_selector("a[href*='/refinery/settings/new']")
      end

      context "new/create" do
        it "adds setting", :js => true do
          visit refinery.admin_settings_path
          click_link "Add new setting"

          page.should have_selector('iframe#dialog_iframe')

          page.within_frame('dialog_iframe') do
            fill_in "Name", :with => "test setting"
            fill_in "Value", :with => "true"

            click_button "Save"
          end

          page.should have_content("'Test Setting' was successfully added.")
          page.should have_content("Test Setting - true")
        end
      end

      context "pagination" do
        before(:each) do
          (Refinery::Setting.per_page + 1).times do
            FactoryGirl.create(:setting)
          end
        end

        specify "page links" do
          visit refinery.admin_settings_path

          page.should have_selector("a[href*='settings?page=2']")
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
refinerycms-settings-2.0.2 spec/requests/refinery/admin/settings_spec.rb
refinerycms-settings-2.0.1 spec/requests/refinery/admin/settings_spec.rb
refinerycms-settings-2.0.0 spec/requests/refinery/admin/settings_spec.rb