Sha256: 0d2d7fad5dfbdadea51ff6e43b06a471aeeb401df8e068beee627da06447df4b

Contents?: true

Size: 1.13 KB

Versions: 7

Compression:

Stored size: 1.13 KB

Contents

require 'spec_helper'

describe "creating a new record" do
  before :each do
    login
    give_permission("Person")
    visit new_outpost_person_path
  end

  context "invalid" do
    it "shows validation errors" do
      fill_in "person_name", with: ""
      fill_in "person_email", with: ""
      click_button "edit"
      current_path.should eq outpost_people_path

      Person.count.should eq 0

      page.should_not have_css ".alert-success"

      # FIXME: These are too specific to simple form
      page.should have_content "Please review the problems below"
      page.should have_css ".error"
    end
  end

  context "valid" do
    it "is created" do
      fill_in "person_name", with: "Bryan"
      fill_in "person_email", with: "bricker@kpcc.org"
      click_button "edit"

      person = Person.first
      current_path.should eq edit_outpost_person_path(person)

      Person.count.should eq 1

      page.should have_css ".alert-success"
      page.should_not have_content "Please review the problems below"
      page.should_not have_css ".error"
      page.should have_css "#edit_#{Person.singular_route_key}_#{person.id}"
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
outpost-cms-0.1.4 spec/features/creating_spec.rb
outpost-cms-0.1.3 spec/features/creating_spec.rb
outpost-cms-0.1.2 spec/features/creating_spec.rb
outpost-cms-0.1.1 spec/features/creating_spec.rb
outpost-cms-0.1.0 spec/features/creating_spec.rb
outpost-cms-0.0.5 spec/features/creating_spec.rb
outpost-cms-0.0.4 spec/features/creating_spec.rb