Sha256: 027651136b5813c4869b298e82a10682d4300c54d7c4857b5ec2ae8f7021009b

Contents?: true

Size: 1.09 KB

Versions: 3

Compression:

Stored size: 1.09 KB

Contents

require 'spec_helper'

describe_with_capybara "Belongs To" do

  let(:user){ User.create(:first_name => "John", :last_name => "Doe", :username => "johndoe") }
  let(:post){ user.posts.create :title => "Hello World", :body => "woot!"}

  before do
    # Make sure both are created
    user
    post
  end

  describe "the index page" do
    before do
      visit admin_user_posts_path(user)
    end

    describe "the main content" do
      it "should display the default table" do
        page.should have_content(post.title)
      end
    end

    describe "the breadcrumb" do
      it "should have a link to the parent's index" do
        page.body.should have_tag("a", "Users", :attributes => { :href => "/admin/users" })
      end
      it "should have a link to the parent" do
        page.body.should have_tag("a", user.id.to_s, :attributes => { :href => "/admin/users/#{user.id}" })
      end
    end

    describe "the view links" do
      it "should take you to the sub resource" do
        click "View"
        current_path.should == "/admin/users/#{user.id}/posts/#{post.id}"
      end
    end
  end

end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
saulolso-activeadmin-0.2.2.1 spec/integration/belongs_to_spec.rb
saulolso-activeadmin-0.2.2 spec/integration/belongs_to_spec.rb
activeadmin-0.2.2 spec/integration/belongs_to_spec.rb