@@ -1,4 +1,4 @@ |
||
1 |
-<%= content_tag(:li, class: 'span4') do %> |
|
1 |
+<%= content_tag(:li, class: 'span4', id: "mission-#{mission.slug}") do %> |
|
2 | 2 |
<% content_tag(:div, class: 'thumbnail') do %> |
3 | 3 |
<%= link_to mission_path(mission) do %> |
4 | 4 |
<%= mission.cover_img? ? (image_tag mission.cover_img.thumb, size: '400x300') : image_tag('http://placehold.it/400x300') %> |
@@ -1,4 +1,4 @@ |
||
1 |
-<%= content_tag(:div, class: 'container container-tabs') do %> |
|
1 |
+<%= content_tag(:div, class: 'container container-tabs', id: 'mission-tabs-nav') do %> |
|
2 | 2 |
<%= content_tag(:div, class: 'row') do %> |
3 | 3 |
<%= content_tag(:div, class: 'span12') do %> |
4 | 4 |
<%= content_tag(:ul, class: 'nav nav-tabs') do %> |
@@ -14,7 +14,7 @@ |
||
14 | 14 |
|
15 | 15 |
<%= content_tag(:h2, (t 'mission.featured_missions'))%> |
16 | 16 |
|
17 |
- <%= content_tag(:div, class: 'row-fluid box ') do %> |
|
17 |
+ <%= content_tag(:div, class: 'row-fluid box ', id: "mission-#{@featured_missions.slug}") do %> |
|
18 | 18 |
<%= content_tag(:div, class: 'span8') do %> |
19 | 19 |
<%= link_to mission_path(@featured_missions) do %> |
20 | 20 |
<%= @featured_missions.cover_img? ? (image_tag @featured_missions.cover_img.feature) : image_tag('http://placehold.it/1200x780') %> |
@@ -14,7 +14,8 @@ |
||
14 | 14 |
|
15 | 15 |
<%= content_tag(:ul, class: 'thumbnails mission-list') do %> |
16 | 16 |
<% @mission.mission_agents.each do |agent| %> |
17 |
- <%= content_tag(:li, class: 'span4') do %> |
|
17 |
+ <% role = agent.role.to_s %> |
|
18 |
+ <%= content_tag(:li, class: 'span4', id: "agent-#{role.tr(' ', '-').tr('.', '')}".downcase) do %> |
|
18 | 19 |
<% content_tag(:div, class: 'thumbnail') do %> |
19 | 20 |
<%= content_tag(:div, class: 'thumbnail-content') do%> |
20 | 21 |
<%= content_tag(:h3, (link_to agent.role, mission_agent_details_path(@mission, agent))) %> |
@@ -7,18 +7,58 @@ Feature: Missions |
||
7 | 7 |
Background: |
8 | 8 |
Given the website is configured |
9 | 9 |
And the following list of missions |
10 |
- | title | objective | briefing | slug | status | |
|
11 |
- | Bank Robbery | Rob a bank and get rich | The target will be Fort Knox. Only expert agents allowed. | hello_world | 1 | |
|
12 |
- | Test 001 | 1 2 3 testing | Testing the website | test_001 | 1 | |
|
10 |
+ | title | objective | briefing | status | |
|
11 |
+ | Test 001 | 1 2 3 testing | Testing the website | 2 | |
|
12 |
+ | Bank Robbery | Rob a bank and get rich | The target will be Fort Knox. Only expert agents allowed. | 2 | |
|
13 | 13 |
And the the mission "Bank Robbery" has the following agents |
14 | 14 |
| role | objective | briefing | description | |
15 |
- | Mr. Pink | Get the money in the vault | Find the manager, make him open the vault and get all the money | | |
|
15 |
+ | Mr. Pink | Get the inside the vault | Find the manager, make him open the vault and get all the money | | |
|
16 | 16 |
| Mr. Blue | Take care of the hostages | Make sure the hostages dont try anything stupid. | | |
17 | 17 |
| Mr. Green | Drive the gettaway car | Wait for the others to return and lose the cops. | | |
18 |
+ And the the agent "Mr. Pink" in the mission "Bank Robbery" has the following steps |
|
19 |
+ | step | title | description | completed | |
|
20 |
+ | 1 | Get to the bank | Make everbody surrender | false | |
|
21 |
+ | 2 | Find the bank manager | Find the bank manager with the vault keys | false | |
|
22 |
+ | 3 | Open the vault | Use the keys to open the vault | false | |
|
23 |
+ | 4 | Get the money | Put all the money in the bag | false | |
|
24 |
+ | 5 | Leave the bank | Exit the bank and get to the getaway car | false | |
|
25 |
+ And the the agent "Mr. Blue" in the mission "Bank Robbery" has the following steps |
|
26 |
+ | step | title | description | completed | |
|
27 |
+ | 1 | Get to the bank | Make everbody surrender | false | |
|
28 |
+ | 2 | Secure the hostages | Secure the hostages while Mr. pink gets the vault | false | |
|
29 |
+ | 3 | Leave the bank | Exit the bank and get to the getaway car | false | |
|
30 |
+ And the the agent "Mr. Green" in the mission "Bank Robbery" has the following steps |
|
31 |
+ | step | title | description | completed | |
|
32 |
+ | 1 | Get a good car for the job | Find a good car for the mission | false | |
|
33 |
+ | 2 | Take everbody to the bank | Take Mr. Pink and Mr. Blue to the bank | false | |
|
34 |
+ | 3 | Getaway | Wait for Mr. Pink and Mr. Blue to return and lose the cops | false | |
|
18 | 35 |
|
19 | 36 |
Scenario: View mission list |
20 | 37 |
When I go to the missions page |
21 | 38 |
Then I should see "Bank Robbery" |
22 |
- And I should see "Rob a bank and get rich" |
|
39 |
+ And within "#mission-bank-robbery" I should see "Rob a bank and get rich" |
|
40 |
+ And within "#mission-bank-robbery" I should see "Launched" |
|
41 |
+ And within "#mission-bank-robbery" I should see "0%" |
|
23 | 42 |
And I should see "Test 001" |
24 |
- And I should see "1 2 3 testing" |
|
43 |
+ And within "#mission-test-001" I should see "1 2 3 testing" |
|
44 |
+ And within "#mission-test-001" I should see "Launched" |
|
45 |
+ And within "#mission-test-001" I should see "0%" |
|
46 |
+ |
|
47 |
+ Scenario: View mission |
|
48 |
+ When I go to the missions page |
|
49 |
+ And I click in the link "Bank Robbery" |
|
50 |
+ Then within "h1" I should see "Bank Robbery" |
|
51 |
+ And I should see "Launched" |
|
52 |
+ And I should see "0%" |
|
53 |
+ And I should see "The target will be Fort Knox. Only expert agents allowed." |
|
54 |
+ When within "#mission-tabs-nav" I click in the link "Agents" |
|
55 |
+ Then I should see "Mr. Pink" |
|
56 |
+ And within "#agent-mr-pink" I should see "Get the inside the vault" |
|
57 |
+ And within "#agent-mr-pink" I should see "Get to the bank" |
|
58 |
+ And within "#agent-mr-pink" I should see "Find the bank manager" |
|
59 |
+ And within "#agent-mr-pink" I should not see "Leave the bank" |
|
60 |
+ And I should see "Mr. Blue" |
|
61 |
+ And I should see "Mr. Green" |
|
62 |
+ |
|
63 |
+ |
|
64 |
+ |
@@ -13,4 +13,10 @@ end |
||
13 | 13 |
|
14 | 14 |
When(/^I click in the button "(.*?)"$/) do |arg1| |
15 | 15 |
click_button arg1 |
16 |
+end |
|
17 |
+ |
|
18 |
+Then(/^within "(.*?)" I click in the link "(.*?)"$/) do |arg1, arg2| |
|
19 |
+ within(arg1) do |
|
20 |
+ click_link(arg2) |
|
21 |
+ end |
|
16 | 22 |
end |
@@ -8,9 +8,18 @@ Given(/^the following list of missions$/) do |table| |
||
8 | 8 |
end |
9 | 9 |
|
10 | 10 |
Given(/^the the mission "(.*?)" has the following agents$/) do |arg1, table| |
11 |
- mission = Mission.where(title: arg1) |
|
11 |
+ mission = Mission.where(title: arg1).first |
|
12 | 12 |
table.hashes.each do |hash| |
13 | 13 |
agent = FactoryGirl.create("mission_agent", hash) |
14 |
- agent.update(mission_id: mission) |
|
14 |
+ agent.update(mission_id: mission.id) |
|
15 |
+ end |
|
16 |
+end |
|
17 |
+ |
|
18 |
+Given(/^the the agent "(.*?)" in the mission "(.*?)" has the following steps$/) do |arg1, arg2, table| |
|
19 |
+ mission = Mission.where(title: arg2).first |
|
20 |
+ agent = MissionAgent.where(role: arg1, mission_id: mission).first |
|
21 |
+ table.hashes.each do |hash| |
|
22 |
+ step = FactoryGirl.create("agent_step", hash) |
|
23 |
+ step.update(mission_agent_id: agent.id) |
|
15 | 24 |
end |
16 | 25 |
end |
@@ -0,0 +1,10 @@ |
||
1 |
+Then(/^within "(.*?)" I should see "(.*?)"$/) do |arg1, arg2| |
|
2 |
+ # within(arg1) do |
|
3 |
+ # page.should have_content(arg2) |
|
4 |
+ # end |
|
5 |
+ page.find(arg1).should have_content(arg2) |
|
6 |
+end |
|
7 |
+ |
|
8 |
+Then(/^within "(.*?)" I should not see "(.*?)"$/) do |arg1, arg2| |
|
9 |
+ page.find(arg1).should_not have_content(arg2) |
|
10 |
+end |
@@ -44,7 +44,6 @@ FactoryGirl.define do |
||
44 | 44 |
|
45 | 45 |
factory :mission do |f| |
46 | 46 |
f.title "Test #1505" |
47 |
- f.slug "test_1505" |
|
48 | 47 |
f.objective "Test the avalanche network system for possible error." |
49 | 48 |
f.briefing "Iterate thru all tests to check the system for possible errors or bugs." |
50 | 49 |
end |
@@ -56,5 +55,12 @@ FactoryGirl.define do |
||
56 | 55 |
f.description "" |
57 | 56 |
end |
58 | 57 |
|
58 |
+ factory :agent_step do |f| |
|
59 |
+ f.step 1 |
|
60 |
+ f.title "Do this" |
|
61 |
+ f.description "Do this thing like this." |
|
62 |
+ f.completed false |
|
63 |
+ end |
|
64 |
+ |
|
59 | 65 |
end |
60 | 66 |
|