features/belongs_to.feature in activeadmin-1.0.0.pre4 vs features/belongs_to.feature in activeadmin-1.0.0.pre5

- old
+ new

@@ -19,13 +19,71 @@ Then the "Posts" tab should be selected And I should not see a menu item for "Users" And I should see "Displaying 1 Post" And I should see a link to "Users" in the breadcrumb And I should see a link to "Jane Doe" in the breadcrumb - When I follow "Edit" + + Scenario: Updating a child resource page + Given a configuration of: + """ + ActiveAdmin.register User + ActiveAdmin.register Post do + belongs_to :user + permit_params :title, :body, :published_date if Rails::VERSION::MAJOR >= 4 + + form do |f| + f.inputs "Your Post" do + f.input :title + f.input :body + end + f.inputs "Publishing" do + f.input :published_date + end + f.actions + end + end + """ + When I go to the last author's last post page + Then I follow "Edit Post" + Then I should see the element "form[action='/admin/users/2/posts/2']" Then I should see a link to "Hello World" in the breadcrumb + When I press "Update Post" + Then I should see "Post was successfully updated." + + Scenario: Creating a child resource page + Given a configuration of: + """ + ActiveAdmin.register User + ActiveAdmin.register Post do + belongs_to :user + permit_params :title, :body, :published_date if Rails::VERSION::MAJOR >= 4 + + form do |f| + f.inputs "Your Post" do + f.input :title + f.input :body + end + f.inputs "Publishing" do + f.input :published_date + end + f.actions + end + end + """ + When I go to the last author's posts + Then I follow "New Post" + Then I should see the element "form[action='/admin/users/2/posts']" + Then I fill in "Title" with "Hello World" + Then I fill in "Body" with "This is the body" + + When I press "Create Post" + Then I should see "Post was successfully created." + And I should see the attribute "Title" with "Hello World" + And I should see the attribute "Body" with "This is the body" + And I should see the attribute "Author" with "Jane Doe" + Scenario: Viewing a child resource page Given a configuration of: """ ActiveAdmin.register User ActiveAdmin.register Post do @@ -40,10 +98,10 @@ Scenario: When the belongs to is optional Given a configuration of: """ ActiveAdmin.register User ActiveAdmin.register Post do - belongs_to :user, :optional => true + belongs_to :user, optional: true end """ When I go to the last author's posts Then the "Users" tab should be selected And I should see a menu item for "Posts"