360_services 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. data/360_services.gemspec +42 -0
  2. data/Manifest +48 -0
  3. data/Rakefile +30 -0
  4. data/fakeweb_cache +6650 -0
  5. data/features/manage_accounts.feature +32 -0
  6. data/features/manage_assets.feature +58 -0
  7. data/features/manage_categories.feature +87 -0
  8. data/features/manage_flags.feature +44 -0
  9. data/features/manage_group_assets.feature +33 -0
  10. data/features/manage_groups.feature +29 -0
  11. data/features/manage_metadata.feature +28 -0
  12. data/features/manage_metrics.feature +22 -0
  13. data/features/manage_sites.feature +17 -0
  14. data/features/manage_tags.feature +37 -0
  15. data/features/mange_rate_plan.feature +9 -0
  16. data/features/step_definitions/manage_accounts_steps.rb +19 -0
  17. data/features/step_definitions/manage_assets_steps.rb +62 -0
  18. data/features/step_definitions/manage_categories_steps.rb +56 -0
  19. data/features/step_definitions/manage_flags_steps.rb +19 -0
  20. data/features/step_definitions/manage_group_assets_steps.rb +15 -0
  21. data/features/step_definitions/manage_groups_steps.rb +27 -0
  22. data/features/step_definitions/manage_metadata_steps.rb +29 -0
  23. data/features/step_definitions/manage_metrics_steps.rb +15 -0
  24. data/features/step_definitions/manage_sites_steps.rb +15 -0
  25. data/features/step_definitions/manage_tags_steps.rb +23 -0
  26. data/features/step_definitions/mange_rate_plan_steps.rb +3 -0
  27. data/features/step_definitions/utility_steps.rb +33 -0
  28. data/features/step_definitions/web_steps.rb +259 -0
  29. data/features/support/document_steps.rb +46 -0
  30. data/features/support/env.rb +13 -0
  31. data/features/support/netrecorder.rb +20 -0
  32. data/features/support/paths.rb +27 -0
  33. data/lib/sorenson/services/account.rb +50 -0
  34. data/lib/sorenson/services/array.rb +5 -0
  35. data/lib/sorenson/services/asset.rb +155 -0
  36. data/lib/sorenson/services/base.rb +71 -0
  37. data/lib/sorenson/services/category.rb +52 -0
  38. data/lib/sorenson/services/core_ext/attribute_accessors.rb +40 -0
  39. data/lib/sorenson/services/core_ext/hash.rb +9 -0
  40. data/lib/sorenson/services/core_ext/object.rb +16 -0
  41. data/lib/sorenson/services/core_ext.rb +3 -0
  42. data/lib/sorenson/services/event.rb +28 -0
  43. data/lib/sorenson/services/flag.rb +14 -0
  44. data/lib/sorenson/services/group.rb +41 -0
  45. data/lib/sorenson/services/metric.rb +21 -0
  46. data/lib/sorenson/services/rate_plan.rb +30 -0
  47. data/lib/sorenson/services/site.rb +25 -0
  48. data/lib/sorenson/services/tag.rb +17 -0
  49. data/lib/sorenson/services.rb +18 -0
  50. metadata +161 -0
@@ -0,0 +1,32 @@
1
+ Feature: Manage accounts through the api
2
+ In order to value
3
+ As a role
4
+ I want feature
5
+
6
+ Scenario: Login to Sorenson 360 Account
7
+ Given I am logged in with "integrum@integrumtech.com" and "integrum"
8
+ Then the account attribute "id" should be "db786013-c786-4511-8a0d-73f1bacc2285"
9
+
10
+ Scenario: Get an account
11
+ Given I am logged in
12
+ And I get an account
13
+ Then the account attribute "status" should be "Live"
14
+
15
+ # Scenario: Change password
16
+ # Given I am logged in with "integrum@integrumtech.com" and "newpass"
17
+ # When I change my password to "integrum"
18
+ # Then I should be able to log in with "integrum@integrumtech.com" and "integrum"
19
+ # When I change my password to "newpass"
20
+ # Then I should be able to log in with "integrum@integrumtech.com" and "newpass"
21
+
22
+ @wip
23
+ Scenario: Empty trash
24
+ Given I am logged in
25
+ And I get an account
26
+ And I create an asset
27
+ And I delete the asset
28
+ When I empty the trash
29
+ Given I get all assets
30
+ Then the asset list should not include the asset
31
+
32
+
@@ -0,0 +1,58 @@
1
+ Feature: Manage Assets
2
+ In order to value
3
+ As a role
4
+ I want feature
5
+
6
+ Scenario: Get a list of asset guids by passing a tag name
7
+ Given I am logged in
8
+ And I get all assets
9
+ Then the assets list should contain "e036f43c-2a9f-407f-bc26-19af2b89d222"
10
+
11
+ Scenario: Get asset
12
+ Given I am logged in
13
+ And I get the first asset
14
+ Then the asset attribute "name" should be "capture-4851742166757112347.mp4"
15
+
16
+ Scenario: Get asset count
17
+ Given I am logged in
18
+ Then the asset count should be "14"
19
+
20
+ Scenario: Get asset presets
21
+ Given I am logged in
22
+ And I get the first asset
23
+ Then the preset xml should contain "MP4-squish-007.xss"
24
+
25
+ Scenario: Activate and Deactivate
26
+ Given I am logged in
27
+ And I get the asset with id "e036f43c-2a9f-407f-bc26-19af2b89d222"
28
+ When I deactivate the asset
29
+ And I get all assets
30
+ Then the assets list should not contain the asset id
31
+ When I activate the asset
32
+ And I get all assets
33
+ Then the assets list should contain the asset id
34
+
35
+ Scenario: Delete an asset
36
+ Given I am logged in
37
+ And I get the asset with id "e036f43c-2a9f-407f-bc26-19af2b89d222"
38
+ When I delete the asset
39
+ And I get all assets
40
+ Then the assets list should not contain the asset id
41
+ When I undelete the asset
42
+ And I get all assets
43
+ Then the assets list should contain the asset id
44
+
45
+ Scenario: Save an asset
46
+ Given I am logged in
47
+ And I get the first asset
48
+ When I change the asset attribute "description" to "new description"
49
+ And I save the asset
50
+ And I reload the asset
51
+ Then the asset attribute "description" should be "new description"
52
+ Then I change the asset attribute "description" to "description"
53
+ And I save the asset
54
+
55
+ Scenario: Get asset embed codes
56
+ Given I am logged in
57
+ And I get the first asset
58
+ Then the asset embed codes should contain "flash_media_loader.swf"
@@ -0,0 +1,87 @@
1
+ Feature: Manage categories
2
+ In order to value
3
+ As a role
4
+ I want feature
5
+
6
+ Scenario: Add a category to an asset
7
+ Given I am logged in
8
+ And I get the first asset
9
+ And I assign the category "new category" to the asset
10
+ Then the category attribute "name" should be "new category"
11
+
12
+ Scenario: Remove a category from an asset
13
+ Given I am logged in
14
+ And I get the first asset
15
+ And I assign the category "new category" to the asset
16
+ And I remove the category from the asset
17
+ Then the asset should not have a category
18
+
19
+ Scenario: See the asset category
20
+ Given I am logged in
21
+ And I get the first asset
22
+ And I assign the category "asset category" to the asset
23
+ When I get the category
24
+ Then the category attribute "name" should be "asset category"
25
+
26
+ Scenario: See all categories
27
+ Given I am logged in
28
+ When I create a category named "category1"
29
+ And I get all categories
30
+ Then the categories list should contain "category1"
31
+
32
+ Scenario: Find a category
33
+ Given I am logged in
34
+ When I create a category named "category1"
35
+ And I find the category named "category1"
36
+ Then the category attribute "name" should be "category1"
37
+
38
+ Scenario: Create a category
39
+ Given I am logged in
40
+ When I create a category named "category1"
41
+ Then the category attribute "name" should be "category1"
42
+
43
+ Scenario: Save a category
44
+ Given I am logged in
45
+ When I create a category named "category1"
46
+ And I change the category attribute "description" to "moocow"
47
+ And I save the category
48
+ When I find the category named "category1"
49
+ Then the category attribute "description" should be "moocow"
50
+
51
+ Scenario: Add a sub category
52
+ Given I am logged in
53
+ When I create a category named "category1"
54
+ And I create a category named "child of category 1"
55
+ And I change the category attribute "parent" to "category1"
56
+ And I save the category
57
+ When I find the category named "child of category 1"
58
+ Then the parent of the category should be "category1"
59
+
60
+ Scenario: Delete a category
61
+ Given I am logged in
62
+ And I create a category named "category1"
63
+ And I get all categories
64
+ Then the categories list should contain "category1"
65
+ When I delete the category
66
+ And I get all categories
67
+ Then the categories list should not contain "category1"
68
+
69
+ Scenario: See all assets belonging to a category
70
+ Given I am logged in
71
+ And I get the first asset
72
+ And I assign the category "my category" to the asset
73
+ And I find the category named "my category"
74
+ When I get the category assets
75
+ Then the assets list should contain the asset
76
+
77
+ Scenario: List root categories
78
+ Given I am logged in
79
+ And I create a category named "cat1"
80
+ And I create a category named "cat1 child"
81
+ And I change the category attribute "parent" to "cat1"
82
+ And I save the category
83
+ And I get the root categories
84
+ Then the categories list should contain "cat1"
85
+ And the categories list should not contain "cat1 child"
86
+
87
+
@@ -0,0 +1,44 @@
1
+ Feature: Manage Flags
2
+ In order to value
3
+ As a role
4
+ I want feature
5
+
6
+ Scenario: List all flags
7
+ Given I am logged in
8
+ When I get the first asset
9
+ And I assign the flags "red blue green" to the asset
10
+ When I get all flags
11
+ Then the flags list should contain "red"
12
+
13
+ Scenario: List flagged assets
14
+ Given I am logged in
15
+ When I get the first asset
16
+ And I assign the flags "red blue green" to the asset
17
+ When I get all flags
18
+ Then the flags list should contain "red"
19
+
20
+ Scenario: Count flags
21
+ Given I am logged in
22
+ Then the flag count should be 4
23
+
24
+ Scenario: Add flags to asset
25
+ Given I am logged in
26
+ And I get the first asset
27
+ And I assign the flags "red blue green" to the asset
28
+ Then the flags list should contain "red"
29
+ Then the flags list should contain "blue"
30
+ Then the flags list should contain "green"
31
+
32
+ Scenario: Find all assets by flag
33
+ Given I am logged in
34
+ And I get the first asset
35
+ And I assign the flag "red" to the asset
36
+ And I find all assets with the flag "red"
37
+ Then the assets list should contain "c67f1fdb-8199-4b5c-921f-d864cf2d903f"
38
+
39
+ Scenario: Get asset flags
40
+ Given I am logged in
41
+ And I get the first asset
42
+ And I assign the flag "pear" to the asset
43
+ And I get the flags for the asset
44
+ Then the flags list should contain "pear"
@@ -0,0 +1,33 @@
1
+ Feature: Manage group assets
2
+ In order to value
3
+ As a role
4
+ I want feature
5
+
6
+ Background:
7
+ Given I am logged in
8
+ And I get the first asset
9
+ And I find the group with the name "my group"
10
+ Then I delete the group if it was found
11
+
12
+ Scenario: Add an asset to a group
13
+ And I create a group named "my group"
14
+ When I add the asset to the group
15
+ And I reload the group
16
+ Then the asset should be in the group
17
+
18
+ Scenario: Get the asset groups
19
+ And I create a group named "my group"
20
+ And I add the asset to the group
21
+ When I reload the asset
22
+ Then the asset should have the group
23
+
24
+ Scenario: Get group assets
25
+ Given I am logged in
26
+ And I get the first asset
27
+ And I create a group named "my group"
28
+ And I add the asset to the group
29
+ And I reload the group
30
+ Then the group should have the asset
31
+
32
+
33
+
@@ -0,0 +1,29 @@
1
+ Feature: Manage groups
2
+ In order to value
3
+ As a role
4
+ I want feature
5
+
6
+ Background:
7
+ Given I am logged in
8
+ And I find the group with the name "my group"
9
+ Then I delete the group if it was found
10
+
11
+ Scenario: Create a group
12
+ When I create a group named "my group"
13
+ Then the group attribute "name" should be "my group"
14
+
15
+ Scenario: Find a group by id
16
+ When I create a group named "my group"
17
+ Then I should be able to find the group
18
+
19
+ Scenario: Get all groups
20
+ And I create a group named "my group"
21
+ And I get all groups
22
+ Then the groups list should contain the group id
23
+
24
+ Scenario: Delete a group
25
+ When I create a group named "delete me"
26
+ And I reload the group
27
+ And I delete the group
28
+ And I get all groups
29
+ Then the groups list should not contain the group id
@@ -0,0 +1,28 @@
1
+ Feature: Manage Metadata
2
+ In order to value
3
+ As a role
4
+ I want feature
5
+
6
+ Scenario: Add metadata to asset and find it
7
+ Given I am logged in
8
+ And I get the first asset
9
+ And I add the metadata "key" with the value "value" to the asset
10
+ When I reload the asset
11
+ Then the asset metadata value for "key" should be "value"
12
+
13
+ Scenario: Delete metadata
14
+ Given I am logged in
15
+ And I get the first asset
16
+ And I add the metadata "key" with the value "value" to the asset
17
+ When I delete the metadata key "key"
18
+ And I reload the asset
19
+ Then the asset should not have a metadata value for "key"
20
+
21
+ Scenario: Get all metadata
22
+ Given I am logged in
23
+ And I get the first asset
24
+ And I add the metadata "color" with the value "blue" to the asset
25
+ And I add the metadata "size" with the value "medium" to the asset
26
+ And I get all the metadata for the asset
27
+ Then the metadata for the asset should contain "color=blue"
28
+ And the metadata for the asset should contain "size=medium"
@@ -0,0 +1,22 @@
1
+ Feature: Manage Metrics
2
+ In order to value
3
+ As a role
4
+ I want feature
5
+
6
+ Scenario: See Total Plays
7
+ Given I am logged in
8
+ Then the total plays should be "12"
9
+
10
+ Scenario: See Storage Used
11
+ Given I am logged in
12
+ Then the storage used should be "-12290471.0"
13
+
14
+ Scenario: See all metrics
15
+ Given I am logged in
16
+ And I get all metrics
17
+ Then the events list should contain an event with a day of "2009-12-17"
18
+
19
+
20
+
21
+
22
+
@@ -0,0 +1,17 @@
1
+ Feature: Manage Sites
2
+ In order to value
3
+ As a role
4
+ I want feature
5
+
6
+ Scenario: Create a site and view list
7
+ Given I am logged in
8
+ When I create a new site with the name "new site name" and the description "new site description"
9
+ And I get all sites
10
+ Then the sites list should contain "new site name"
11
+
12
+ Scenario: Get a site by name
13
+ Given I am logged in
14
+ When I create a new site with the name "new site name" and the description "new site description"
15
+ And I get the site named "new site name"
16
+ Then the site attribute "id" should be "b4b866a0-d7d8-012c-1ba4-00254b9d9628"
17
+
@@ -0,0 +1,37 @@
1
+ Feature: Manage Tags
2
+ In order to value
3
+ As a role
4
+ I want feature
5
+
6
+ Scenario: Add tags to asset
7
+ Given I am logged in
8
+ And I get the first asset
9
+ And I assign the tags "apple orange pear" to the asset
10
+ Then the tags list should contain "apple"
11
+ Then the tags list should contain "orange"
12
+ Then the tags list should contain "pear"
13
+
14
+ Scenario: Find all assets by tag
15
+ Given I am logged in
16
+ And I get the first asset
17
+ And I assign the tag "apple" to the asset
18
+ And I find all assets with the tag "apple"
19
+ Then the assets list should contain the asset
20
+
21
+ Scenario: Get asset tags
22
+ Given I am logged in
23
+ And I get the first asset
24
+ And I assign the tag "red" to the asset
25
+ And I get the tags for the asset
26
+ Then the tags list should contain "red"
27
+
28
+ Scenario: Get tag count
29
+ Given I am logged in
30
+ Then the tag count should be "7"
31
+
32
+ Scenario: Get all tags
33
+ Given I am logged in
34
+ And I get the first asset
35
+ And I assign the tag "apple" to the asset
36
+ And I get all tags
37
+ Then the tags list should contain "apple"
@@ -0,0 +1,9 @@
1
+ Feature: Mange rate plan
2
+ In order to value
3
+ As a role
4
+ I want feature
5
+
6
+ Scenario: Get the rate plan
7
+ Given I am logged in
8
+ And I get the rate plan
9
+ Then the rate plan attribute "rate plan type" should be "RATE_PLAN_BASIC"
@@ -0,0 +1,19 @@
1
+ Given /^I (?:am logged|should be able to log) in with "([^\"]*)" and "([^\"]*)"$/ do |arg1, arg2|
2
+ @account = Sorenson::Services::Account.login(arg1, arg2)
3
+ end
4
+
5
+ Given "I am logged in" do
6
+ @account = Sorenson::Services::Account.login("integrum@integrumtech.com", "integrum")
7
+ end
8
+
9
+ And /^I get an account$/ do
10
+ @account = Sorenson::Services::Account.get_account
11
+ end
12
+
13
+ When /^I change my password to "([^\"]*)"$/ do |arg1|
14
+ @account.set_password(arg1, 'anything')
15
+ end
16
+
17
+ When /^I empty the trash$/ do
18
+ @account.empty_trash
19
+ end
@@ -0,0 +1,62 @@
1
+ When "I get all assets" do
2
+ @assets = Sorenson::Services::Asset.all
3
+ end
4
+
5
+ And /^I get the asset with id "([^\"]*)"$/ do |arg1|
6
+ @asset = Sorenson::Services::Asset.find(arg1)
7
+ end
8
+
9
+ And "I get the first asset" do
10
+ @asset = Sorenson::Services::Asset.find(Sorenson::Services::Asset.all.first)
11
+ @asset.should_not be_nil
12
+ end
13
+
14
+ Then /^the asset count should be "([^\"]*)"$/ do |arg1|
15
+ Sorenson::Services::Asset.count.should == arg1.to_i
16
+ end
17
+
18
+ And /^I create an asset$/ do
19
+ pending # express the regexp above with the code you wish you had
20
+ end
21
+
22
+ And /^I delete the asset$/ do
23
+ @asset.destroy
24
+ end
25
+
26
+ Then /^the asset list should not include the asset$/ do
27
+ pending # express the regexp above with the code you wish you had
28
+ end
29
+
30
+ Then /^the preset xml should contain "([^\"]*)"$/ do |arg1|
31
+ @asset.preset_xml.should include(arg1)
32
+ end
33
+
34
+ When /^I deactivate the asset$/ do
35
+ @asset.deactivate
36
+ end
37
+
38
+ When /^I activate the asset$/ do
39
+ @asset.activate
40
+ end
41
+
42
+ When /^I undelete the asset$/ do
43
+ @asset.activate
44
+ end
45
+
46
+ When /^I save the asset$/ do
47
+ @asset.save
48
+ end
49
+
50
+ When /^I reload the asset$/ do
51
+ @asset = Sorenson::Services::Asset.find(@asset.id)
52
+ end
53
+
54
+ Then /^I get the embed codes$/ do
55
+ @embed_codes = @asset.embed_codes
56
+ end
57
+
58
+ Then /^the asset embed codes should contain "([^\"]*)"$/ do |value|
59
+ @asset.embed_codes.each do |embed_code|
60
+ embed_code.should include(value)
61
+ end
62
+ end
@@ -0,0 +1,56 @@
1
+ When /^I get the category$/ do
2
+ @category = @asset.category
3
+ end
4
+
5
+ When /^I assign the category "([^\"]*)" to the asset$/ do |name|
6
+ @category = @asset.add_category(name)
7
+ end
8
+
9
+ When /^I remove the category from the asset$/ do
10
+ @asset.remove_category
11
+ end
12
+
13
+ Then /^the asset should not have a category$/ do
14
+ @asset.category.should be_nil
15
+ end
16
+
17
+ Then /^the asset category should be "([^\"]*)"$/ do |arg1|
18
+ @asset.category.should == arg1
19
+ end
20
+
21
+ When /^I create a category named "([^\"]*)"$/ do |name|
22
+ @category = Sorenson::Services::Category.create(name)
23
+ end
24
+
25
+ And /^I get all categories$/ do
26
+ @categories = Sorenson::Services::Category.all
27
+ end
28
+
29
+ When /^I find the category named "([^\"]*)"$/ do |name|
30
+ @category = Sorenson::Services::Category.find_by_name(name)
31
+ @category.should_not be_nil
32
+ end
33
+
34
+ And /^I save the category$/ do
35
+ @category.save
36
+ end
37
+
38
+ Then /^the parent of the category should be "([^\"]*)"$/ do |name|
39
+ @category.parent.should == name
40
+ end
41
+
42
+ When /^I delete the category$/ do
43
+ @category.destroy
44
+ end
45
+
46
+ When /^I get the category assets$/ do
47
+ @assets = @category.assets
48
+ end
49
+
50
+ Then /^the assets list should contain the asset$/ do
51
+ @assets.should include(@asset.id)
52
+ end
53
+
54
+ And /^I get the root categories$/ do
55
+ @categories = Sorenson::Services::Category.all_roots
56
+ end
@@ -0,0 +1,19 @@
1
+ When /^I get all flags$/ do
2
+ @flags = Sorenson::Services::Flag.all
3
+ end
4
+
5
+ Then /^the flag count should be ([^\"]*)$/ do |count|
6
+ Sorenson::Services::Flag.count.should == count.to_i
7
+ end
8
+
9
+ And /^I assign the (?:flag|flags) "([^\"]*)" to the asset$/ do |arg1|
10
+ @flags = @asset.add_flags(arg1)
11
+ end
12
+
13
+ And /^I find all assets with the flag "([^\"]*)"$/ do |arg1|
14
+ @assets = Sorenson::Services::Asset.find_all_by_flag(arg1)
15
+ end
16
+
17
+ And /^I get the flags for the asset$/ do
18
+ @tags = @asset.flags
19
+ end
@@ -0,0 +1,15 @@
1
+ When /^I add the asset to the group$/ do
2
+ @group.add_asset(@asset)
3
+ end
4
+
5
+ Then /^the asset should be in the group$/ do
6
+ @group.assets.should include(@asset.id)
7
+ end
8
+
9
+ Then /^the asset should have the group$/ do
10
+ @asset.groups.should include(@group.id)
11
+ end
12
+
13
+ Then /^the group should have the asset$/ do
14
+ @group.assets.should include(@asset.id) # express the regexp above with the code you wish you had
15
+ end
@@ -0,0 +1,27 @@
1
+ And /^I find the group with the name "([^\"]*)"$/ do |name|
2
+ @group = Sorenson::Services::Group.find_by_name(name)
3
+ end
4
+
5
+ When /^I create a group named "([^\"]*)"$/ do |name|
6
+ @group = Sorenson::Services::Group.create(name)
7
+ end
8
+
9
+ When /^I reload the group$/ do
10
+ @group = Sorenson::Services::Group.find(@group.id)
11
+ end
12
+
13
+ Then /^I should be able to find the group$/ do
14
+ @group = Sorenson::Services::Group.find(Sorenson::Services::Group.all.first)
15
+ end
16
+
17
+ And /^I get all groups$/ do
18
+ @groups = Sorenson::Services::Group.all
19
+ end
20
+
21
+ Then /^I delete the group if it was found$/ do
22
+ @group.destroy if @group
23
+ end
24
+
25
+ Then /^I delete the group$/ do
26
+ @group.destroy
27
+ end
@@ -0,0 +1,29 @@
1
+ When /^the asset metadata value for "([^\"]*)" should be "([^\"]*)"$/ do |key, value|
2
+ @asset.get_metadata_value(key).should == value
3
+ end
4
+
5
+ When /^I add the metadata "([^\"]*)" with the value "([^\"]*)" to the asset$/ do |key, value|
6
+ @asset.set_metadata(key, value)
7
+ end
8
+
9
+ When /^I delete the metadata key "([^\"]*)"$/ do |key|
10
+ data = @asset.delete_metadata(key)
11
+ data['status'] if data
12
+ end
13
+
14
+ Then /^the asset should not have a metadata value for "([^\"]*)"$/ do |key|
15
+ @asset.get_metadata_value(key).should == nil
16
+ end
17
+
18
+ And /^I get all the metadata for the asset$/ do
19
+ @metadata = @asset.metadata
20
+ end
21
+
22
+ Then /^the metadata list should include "([^\"]*)"$/ do |arg1|
23
+ pending # express the regexp above with the code you wish you had
24
+ end
25
+
26
+ Then /^the metadata for the asset should contain "([^\"]*)"$/ do |keyvalue|
27
+ values = keyvalue.split("=")
28
+ @metadata[values[0]].should == values[1]
29
+ end
@@ -0,0 +1,15 @@
1
+ Then /^the total plays should be "([^\"]*)"$/ do |total|
2
+ Sorenson::Services::Metric.total_plays.should == total.to_i
3
+ end
4
+
5
+ Then /^the storage used should be "([^\"]*)"$/ do |storage|
6
+ Sorenson::Services::Metric.storage_used.should == storage.to_i
7
+ end
8
+
9
+ And /^I get all metrics$/ do
10
+ @events = Sorenson::Services::Metric.all
11
+ end
12
+
13
+ Then /^the events list should contain an event with a day of "([^\"]*)"$/ do |day|
14
+ @events.select {|event| event.date == Date.parse(day)}.should_not be_empty
15
+ end
@@ -0,0 +1,15 @@
1
+ When /^I create a new site with the name "([^\"]*)" and the description "([^\"]*)"$/ do |name, description|
2
+ Sorenson::Services::Site.create(name, :description => description)
3
+ end
4
+
5
+ And /^I get all sites$/ do
6
+ @sites = Sorenson::Services::Site.all
7
+ end
8
+
9
+ And /^I get the site named "([^\"]*)"$/ do |name|
10
+ @site = Sorenson::Services::Site.find_by_name(name)
11
+ end
12
+
13
+ Then /^the site should have an id$/ do
14
+ @site.id.should == '5'
15
+ end