litmus 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "Litmus" do
4
+
5
+ end
@@ -0,0 +1,19 @@
1
+ require 'spec_helper'
2
+
3
+ describe Litmus::PageTest do
4
+ describe ".list" do
5
+ it "should give me a list of page test objects" do
6
+ list = Litmus::PageTest.list
7
+ list.length.should eql(1)
8
+ list.first["name"].should eql("Home | Real Ale Hunter")
9
+ list.first["id"].should eql(1715752)
10
+ end
11
+ end
12
+
13
+ describe ".create" do
14
+ it "should give me back a new page object" do
15
+ page_test = Litmus::PageTest.create("http://matthewfawcett.co.uk/")
16
+ page_test["id"].should == 1716444
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ require 'spec_helper'
2
+
3
+ describe Litmus::Result do
4
+ describe ".list" do
5
+ it "should give me an array of results" do
6
+ results = Litmus::Result.list(1715760, 1)
7
+ results.count.should == 17
8
+ results.first["result_images"].first["full_image"].should =~ /s3.amazonaws.com/
9
+ end
10
+ end
11
+
12
+ describe ".show" do
13
+ it "should return a result object" do
14
+ result = Litmus::Result.show(1715760, 1, 33524970)
15
+ result["id"].should == 33524970
16
+ result["result_images"].first["full_image"].should =~ /s3.amazonaws.com/
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,44 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
+ require 'litmus'
4
+ require 'rspec'
5
+ require 'rspec/autorun'
6
+
7
+ require 'fakeweb'
8
+ FakeWeb.allow_net_connect = false
9
+
10
+ Rspec.configure do |config|
11
+ FakeWeb.register_uri(:get, 'http://matt:yourpassword@matthewfawcett.litmus.com/tests.xml',
12
+ :body => File.join(File.dirname(__FILE__), 'fixtures', 'all_tests.xml'),
13
+ :content_type => "text/xml")
14
+ FakeWeb.register_uri(:post, 'http://matt:yourpassword@matthewfawcett.litmus.com/emails.xml',
15
+ :body => File.join(File.dirname(__FILE__), 'fixtures', 'create_email_test.xml'),
16
+ :content_type => "text/xml")
17
+ FakeWeb.register_uri(:post, 'http://matt:yourpassword@matthewfawcett.litmus.com/pages.xml',
18
+ :body => File.join(File.dirname(__FILE__), 'fixtures', 'create_page_test.xml'),
19
+ :content_type => "text/xml")
20
+ FakeWeb.register_uri(:get, 'http://matt:yourpassword@matthewfawcett.litmus.com/tests/1716450.xml',
21
+ :body => File.join(File.dirname(__FILE__), 'fixtures', 'show_test.xml'),
22
+ :content_type => "text/xml")
23
+ FakeWeb.register_uri(:get, 'http://matt:yourpassword@matthewfawcett.litmus.com/tests/1716450/versions/1.xml',
24
+ :body => File.join(File.dirname(__FILE__), 'fixtures', 'show_test_version.xml'),
25
+ :content_type => "text/xml")
26
+ FakeWeb.register_uri(:get, 'http://matt:yourpassword@matthewfawcett.litmus.com/tests/1715760/versions.xml',
27
+ :body => File.join(File.dirname(__FILE__), 'fixtures', 'list_test_versions.xml'),
28
+ :content_type => "text/xml")
29
+ FakeWeb.register_uri(:post, 'http://matt:yourpassword@matthewfawcett.litmus.com/tests/1715760/versions.xml',
30
+ :body => File.join(File.dirname(__FILE__), 'fixtures', 'create_test_version.xml'),
31
+ :content_type => "text/xml")
32
+ FakeWeb.register_uri(:get, 'http://matt:yourpassword@matthewfawcett.litmus.com/tests/1715760/versions/1/poll.xml',
33
+ :body => File.join(File.dirname(__FILE__), 'fixtures', 'poll_test_version.xml'),
34
+ :content_type => "text/xml")
35
+ FakeWeb.register_uri(:get, 'http://matt:yourpassword@matthewfawcett.litmus.com/tests/1715760/versions/1/results.xml',
36
+ :body => File.join(File.dirname(__FILE__), 'fixtures', 'list_results.xml'),
37
+ :content_type => "text/xml")
38
+ FakeWeb.register_uri(:get, 'http://matt:yourpassword@matthewfawcett.litmus.com/tests/1715760/versions/1/results/33524970.xml',
39
+ :body => File.join(File.dirname(__FILE__), 'fixtures', 'show_result.xml'),
40
+ :content_type => "text/xml")
41
+ config.before(:each) do
42
+ Litmus::Base.new("matthewfawcett", "matt", "yourpassword")
43
+ end
44
+ end
@@ -0,0 +1,10 @@
1
+ require 'spec_helper'
2
+
3
+ describe Litmus::Test do
4
+ describe ".show" do
5
+ it "should give back the test object" do
6
+ test = Litmus::Test.show(1716450)
7
+ test["id"].should == 1716450
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,34 @@
1
+ require 'spec_helper'
2
+
3
+ describe Litmus::TestVersion do
4
+ describe ".show" do
5
+ it "should give me back a test version object" do
6
+ test_version = Litmus::TestVersion.show(1716450, 1)
7
+ test_version["version"].should == 1
8
+ end
9
+ end
10
+
11
+ describe ".list" do
12
+ it "should give me back a an array of test versions" do
13
+ test_versions = Litmus::TestVersion.list(1715760)
14
+ test_versions.size.should == 1
15
+ test_versions.first["version"].should == 1
16
+ end
17
+ end
18
+
19
+ describe ".create" do
20
+ it "should give a new test version object" do
21
+ test_version = Litmus::TestVersion.create(1715760)
22
+ test_version["version"].should == 2
23
+ end
24
+ end
25
+
26
+ describe ".poll" do
27
+ it "should give a simplified test verison" do
28
+ test_version = Litmus::TestVersion.poll(1715760, 1)
29
+ test_version["version"].should == 1
30
+ test_version["results"].size.should == 17
31
+ test_version["results"].first["state"].should == "complete"
32
+ end
33
+ end
34
+ end
metadata ADDED
@@ -0,0 +1,125 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: litmus
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 0
9
+ version: 0.1.0
10
+ platform: ruby
11
+ authors:
12
+ - Matt Fawcett
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-12-19 00:00:00 +00:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: rspec
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 1
29
+ - 2
30
+ - 9
31
+ version: 1.2.9
32
+ type: :development
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: httparty
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ segments:
42
+ - 0
43
+ - 6
44
+ - 1
45
+ version: 0.6.1
46
+ type: :runtime
47
+ version_requirements: *id002
48
+ description: A wrapper to the Litmus customer API
49
+ email: mail@matthewfawcett.co.uk
50
+ executables: []
51
+
52
+ extensions: []
53
+
54
+ extra_rdoc_files:
55
+ - LICENSE
56
+ - README.md
57
+ files:
58
+ - .document
59
+ - LICENSE
60
+ - README.md
61
+ - Rakefile
62
+ - VERSION
63
+ - lib/litmus.rb
64
+ - lib/litmus/base.rb
65
+ - lib/litmus/email_test.rb
66
+ - lib/litmus/page_test.rb
67
+ - lib/litmus/result.rb
68
+ - lib/litmus/test.rb
69
+ - lib/litmus/test_version.rb
70
+ - litmus.gemspec
71
+ - spec/email_test_spec.rb
72
+ - spec/fixtures/all_tests.xml
73
+ - spec/fixtures/create_email_test.xml
74
+ - spec/fixtures/create_page_test.xml
75
+ - spec/fixtures/create_test_version.xml
76
+ - spec/fixtures/list_results.xml
77
+ - spec/fixtures/list_test_versions.xml
78
+ - spec/fixtures/poll_test_version.xml
79
+ - spec/fixtures/show_result.xml
80
+ - spec/fixtures/show_test.xml
81
+ - spec/fixtures/show_test_version.xml
82
+ - spec/litmus_spec.rb
83
+ - spec/page_test_spec.rb
84
+ - spec/result_spec.rb
85
+ - spec/spec_helper.rb
86
+ - spec/test_spec.rb
87
+ - spec/test_version_spec.rb
88
+ has_rdoc: true
89
+ homepage: http://github.com/mattfawcett/litmus
90
+ licenses: []
91
+
92
+ post_install_message:
93
+ rdoc_options: []
94
+
95
+ require_paths:
96
+ - lib
97
+ required_ruby_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ segments:
102
+ - 0
103
+ version: "0"
104
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ segments:
109
+ - 0
110
+ version: "0"
111
+ requirements: []
112
+
113
+ rubyforge_project:
114
+ rubygems_version: 1.3.6
115
+ signing_key:
116
+ specification_version: 3
117
+ summary: A wrapper to the Litmus customer API
118
+ test_files:
119
+ - spec/email_test_spec.rb
120
+ - spec/litmus_spec.rb
121
+ - spec/page_test_spec.rb
122
+ - spec/result_spec.rb
123
+ - spec/spec_helper.rb
124
+ - spec/test_spec.rb
125
+ - spec/test_version_spec.rb