Sha256: e426a057809086f16084aa7446e38bd374903ad05b8b8d57f10fcebcf55cd2a3

Contents?: true

Size: 1.08 KB

Versions: 4

Compression:

Stored size: 1.08 KB

Contents

require "spec_helper"

describe "Categories pages" do
	subject {page}

	let(:user) { Factory(:user) }
	before do 
		visit adminpanel.signin_path
		valid_signin(user)
	end
	
	describe "index" do
		let(:category) { Factory(:category) }
		before do
			visit adminpanel.categories_path
		end

		it { should have_link(I18n.t("category.new"), adminpanel.new_category_path)}
		it { should have_link("i", adminpanel.category_path(category)) }
		it { should have_link("i", adminpanel.edit_category_path(category)) }
	end

	describe "new" do
		before { visit adminpanel.new_category_path }

		it { should have_title(I18n.t("category.new")) }

		describe "with invalid information" do
			before { find("form#new_category").submit_form! }

			it { should have_title(I18n.t("category.new")) }
			it { should have_selector("div#alerts") }
		end

		describe "with valid information" do
			before do
				fill_in "category_name", :with => "category name"
				find("form#new_category").submit_form!
			end

			it { should have_content(I18n.t("category.success"))}
		end
	end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
adminpanel-0.1.1 spec/features/categories_pages_spec.rb
adminpanel-0.1.0cl.2 spec/features/categories_pages_spec.rb
adminpanel-0.1.0cl spec/features/categories_pages_spec.rb
adminpanel-0.1.0 spec/features/categories_pages_spec.rb