Skip to content

Commit fe4e94f

Browse files
committed
Added a cucumber feature for the dashboard section option :if
1 parent a9ffddd commit fe4e94f

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

features/dashboard.feature

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,21 @@ Feature: Dashboard
2424
Then I should not see the default welcome message
2525
And I should see a dashboard widget "Hello World"
2626
And I should see "Hello world from the content"
27+
28+
Scenario: Displaying a dashboard widget using the ':if' option
29+
Given a configuration of:
30+
"""
31+
ActiveAdmin::Dashboards.build do
32+
section 'Hello World', :if => proc{ current_admin_user } do
33+
"Hello world from the content"
34+
end
35+
36+
section 'Hidden by If', :if => proc{ false } do
37+
"Hello world from the content"
38+
end
39+
end
40+
"""
41+
When I go to the dashboard
42+
Then I should not see the default welcome message
43+
And I should see a dashboard widget "Hello World"
44+
And I should not see a dashboard widget "Hidden by If"

features/step_definitions/dashboard_steps.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,9 @@
77
end
88

99
Then /^I should see a dashboard widget "([^"]*)"$/ do |name|
10-
Then %{I should see "#{name}" within ".dashboard .panel h3"}
10+
page.should have_css('.dashboard .panel h3', :text => name)
11+
end
12+
13+
Then /^I should not see a dashboard widget "([^"]*)"$/ do |name|
14+
page.should_not have_css('.dashboard .panel h3', :text => name)
1115
end

0 commit comments

Comments
 (0)