@@ -10,28 +10,35 @@ Feature: Missions |
||
10 | 10 |
| title | objective | briefing | status | |
11 | 11 |
| Test 001 | 1 2 3 testing | Testing the website | 2 | |
12 | 12 |
| Bank Robbery | Rob a bank and get rich | The target will be Fort Knox. Only expert agents allowed. | 2 | |
13 |
+ And the the mission "Bank Robbery" has the following rewards |
|
14 |
+ | title | description | img | |
|
15 |
+ | 1M Dollars | You get 1.000.000,00 dollars | money.png | |
|
16 |
+ | 200K Dollars | You get 200.000,00 dollars | money.png | |
|
13 | 17 |
And the the mission "Bank Robbery" has the following agents |
14 | 18 |
| role | objective | briefing | description | |
15 | 19 |
| Mr. Pink | Get the inside the vault | Find the manager, make him open the vault and get all the money | | |
16 | 20 |
| Mr. Blue | Take care of the hostages | Make sure the hostages dont try anything stupid. | | |
17 | 21 |
| 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 |
|
22 |
+ And the agent "Mr. Pink" in the mission "Bank Robbery" has the following steps |
|
19 | 23 |
| step | title | description | completed | |
20 | 24 |
| 1 | Get to the bank | Make everbody surrender | false | |
21 | 25 |
| 2 | Find the bank manager | Find the bank manager with the vault keys | false | |
22 | 26 |
| 3 | Open the vault | Use the keys to open the vault | false | |
23 | 27 |
| 4 | Get the money | Put all the money in the bag | false | |
24 | 28 |
| 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 |
|
29 |
+ And the agent "Mr. Blue" in the mission "Bank Robbery" has the following steps |
|
26 | 30 |
| step | title | description | completed | |
27 | 31 |
| 1 | Get to the bank | Make everbody surrender | false | |
28 | 32 |
| 2 | Secure the hostages | Secure the hostages while Mr. pink gets the vault | false | |
29 | 33 |
| 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 |
|
34 |
+ And the agent "Mr. Green" in the mission "Bank Robbery" has the following steps |
|
31 | 35 |
| step | title | description | completed | |
32 | 36 |
| 1 | Get a good car for the job | Find a good car for the mission | false | |
33 | 37 |
| 2 | Take everbody to the bank | Take Mr. Pink and Mr. Blue to the bank | false | |
34 | 38 |
| 3 | Getaway | Wait for Mr. Pink and Mr. Blue to return and lose the cops | false | |
39 |
+ And the agent "Mr. Pink" in the mission "Bank Robbery" has the reward "1M Dollars" |
|
40 |
+ And the agent "Mr. Blue" in the mission "Bank Robbery" has the reward "1M Dollars" |
|
41 |
+ And the agent "Mr. Green" in the mission "Bank Robbery" has the reward "200K Dollars" |
|
35 | 42 |
|
36 | 43 |
Scenario: View mission list |
37 | 44 |
When I go to the missions page |
@@ -51,14 +58,22 @@ Feature: Missions |
||
51 | 58 |
And I should see "Launched" |
52 | 59 |
And I should see "0%" |
53 | 60 |
And I should see "The target will be Fort Knox. Only expert agents allowed." |
61 |
+ And I should see "1M Dollars" |
|
62 |
+ And I should see "You get 1.000.000,00 dollars" |
|
63 |
+ And I should see "200K Dollars" |
|
64 |
+ And I should see "You get 200.000,00 dollars" |
|
65 |
+ And I should see the image "money.png" |
|
54 | 66 |
When within "#mission-tabs-nav" I click in the link "Agents" |
55 | 67 |
Then I should see "Mr. Pink" |
56 | 68 |
And within "#agent-mr-pink" I should see "Get the inside the vault" |
57 | 69 |
And within "#agent-mr-pink" I should see "Get to the bank" |
70 |
+ And within "#agent-mr-pink" I should see "1M Dollars" |
|
58 | 71 |
And within "#agent-mr-pink" I should see "Find the bank manager" |
59 | 72 |
And within "#agent-mr-pink" I should not see "Leave the bank" |
60 | 73 |
And I should see "Mr. Blue" |
74 |
+ And within "#agent-mr-blue" I should see "1M Dollars" |
|
61 | 75 |
And I should see "Mr. Green" |
76 |
+ And within "#agent-mr-green" I should see "200K Dollars" |
|
62 | 77 |
|
63 | 78 |
|
64 | 79 |
|
@@ -15,11 +15,30 @@ Given(/^the the mission "(.*?)" has the following agents$/) do |arg1, table| |
||
15 | 15 |
end |
16 | 16 |
end |
17 | 17 |
|
18 |
-Given(/^the the agent "(.*?)" in the mission "(.*?)" has the following steps$/) do |arg1, arg2, table| |
|
18 |
+Given(/^the agent "(.*?)" in the mission "(.*?)" has the following steps$/) do |arg1, arg2, table| |
|
19 | 19 |
mission = Mission.where(title: arg2).first |
20 | 20 |
agent = MissionAgent.where(role: arg1, mission_id: mission).first |
21 | 21 |
table.hashes.each do |hash| |
22 | 22 |
step = FactoryGirl.create("agent_step", hash) |
23 | 23 |
step.update(mission_agent_id: agent.id) |
24 | 24 |
end |
25 |
+end |
|
26 |
+ |
|
27 |
+Given(/^the the mission "(.*?)" has the following rewards$/) do |arg1, table| |
|
28 |
+ mission = Mission.where(title: arg1).first |
|
29 |
+ table.hashes.each do |hash| |
|
30 |
+ file_path = File.expand_path(('../../spec/fixtures/' + hash["img"]), File.dirname(__FILE__)) |
|
31 |
+ file = Rack::Test::UploadedFile.new(file_path) |
|
32 |
+ hash["img"] = file |
|
33 |
+ reward = FactoryGirl.create("reward", hash) |
|
34 |
+ reward.update(mission_id: mission.id) |
|
35 |
+ end |
|
36 |
+end |
|
37 |
+ |
|
38 |
+Given(/^the agent "(.*?)" in the mission "(.*?)" has the reward "(.*?)"$/) do |arg1, arg2, arg3| |
|
39 |
+ mission = Mission.where(title: arg2).first |
|
40 |
+ agent = MissionAgent.where(role: arg1, mission_id: mission).first |
|
41 |
+ reward = Reward.where(title: arg3).first |
|
42 |
+ reward.mission_agents << agent |
|
43 |
+ reward.save |
|
25 | 44 |
end |
@@ -61,6 +61,12 @@ FactoryGirl.define do |
||
61 | 61 |
f.description "Do this thing like this." |
62 | 62 |
f.completed false |
63 | 63 |
end |
64 |
+ |
|
65 |
+ factory :reward do |f| |
|
66 |
+ f.title "Cool Reward" |
|
67 |
+ f.description "Awesome reward description" |
|
68 |
+ f.img "aliens_meme.jpg" |
|
69 |
+ end |
|
64 | 70 |
|
65 | 71 |
end |
66 | 72 |
|