-
Notifications
You must be signed in to change notification settings - Fork 0
/
specifying_actions.feature
93 lines (84 loc) · 2.72 KB
/
specifying_actions.feature
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
Feature: Specifying Actions
Specifying which actions to allow on my resource
Scenario: Only creating the index action
Given a configuration of:
"""
ActiveAdmin.register Post do
actions :index
index do
column do |post|
link_to "View", "/admin/posts/1"
end
end
end
"""
And I am logged in
And a post with the title "Hello World" exists
When I am on the index page for posts
Then an "ActionController::RoutingError" exception should be raised when I follow "View"
Scenario: Specify a custom collection action with template
Given a configuration of:
"""
ActiveAdmin.register Post do
action_item(:import, :only => :index) do
link_to('Import Posts', import_admin_posts_path)
end
collection_action :import
end
"""
Given "app/views/admin/posts/import.html.arb" contains:
"""
para "We are currently working on this feature..."
"""
And I am logged in
When I am on the index page for posts
And I follow "Import"
Then I should see "We are currently working on this feature"
Scenario: Specify a custom member action with template
Given a configuration of:
"""
ActiveAdmin.register Post do
action_item(:review, :only => :show) do
link_to('Review', review_admin_post_path)
end
member_action :review do
@post = Post.find(params[:id])
end
end
"""
Given "app/views/admin/posts/review.html.erb" contains:
"""
<h1>Review: <%= @post.title %></h1>
"""
And I am logged in
And a post with the title "Hello World" exists
When I am on the index page for posts
And I follow "View"
And I follow "Review"
Then I should see "Review: Hello World"
And I should see the page title "Review"
And I should see the Active Admin layout
Scenario: Specify a custom member action with template using arb
Given a configuration of:
"""
ActiveAdmin.register Post do
action_item(:review, :only => :show) do
link_to('Review', review_admin_post_path)
end
member_action :review do
@post = Post.find(params[:id])
end
end
"""
Given "app/views/admin/posts/review.html.arb" contains:
"""
h1 "Review: #{@post.title}"
"""
And I am logged in
And a post with the title "Hello World" exists
When I am on the index page for posts
And I follow "View"
And I follow "Review"
Then I should see "Review: Hello World"
And I should see the page title "Review"
And I should see the Active Admin layout