litmus 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --tty --colour --profile --format nested
data/README.md CHANGED
@@ -7,10 +7,16 @@ Currently Implmented
7
7
  --------------------
8
8
  * Litmus::EmailTest.list
9
9
  * Litmus::EmailTest.show(id)
10
- * Litmus::EmailTest.create
10
+ * Litmus::EmailTest.find_by_name(name)
11
+ * Litmus::EmailTest.create({:subject => '', :body => ''}, name = nil)
12
+ * Litmus::EmailTest.rename(id, new_name)
13
+ * Litmus::EmailTest.destroy(id)
11
14
  * Litmus::PageTest.list
12
15
  * Litmus::PageTest.show(id)
13
- * Litmus::PageTest.create(url)
16
+ * Litmus::PageTest.find_by_name(name)
17
+ * Litmus::PageTest.create(url, name = nil)
18
+ * Litmus::PageTest.rename(id, new_name)
19
+ * Litmus::PageTest.destroy(id)
14
20
  * Litmus::TestVersion.list(test_id)
15
21
  * Litmus::TestVersion.show(test_id, test_version_id)
16
22
  * Litmus::TestVersion.poll(test_id, test_version_id)
@@ -18,6 +24,10 @@ Currently Implmented
18
24
  * Litmus::Result.list(test_id, test_version_id)
19
25
  * Litmus::Result.show(test_id, test_version_id, result_id)
20
26
 
27
+ Install
28
+ -------
29
+ `gem install litmus`
30
+
21
31
 
22
32
  Example Usage
23
33
  -------------
@@ -36,6 +46,9 @@ Example Usage
36
46
 
37
47
  # Lets send them the email
38
48
  Pony.mail(:to => send_test_to, :from => 'mail@matthewfawcett.co.uk', :subject => 'hi', :body => 'Hello there, this is a test')
49
+
50
+ # Alternatively, we could have included the email when the test was created
51
+ alternative_test = Litmus::EmailTest.create({:subject => 'Hello', :body => '<b>Hello, <i>world</i></b>'})
39
52
 
40
53
  # Now they have it
41
54
  Litmus::TestVersion.show(test_id, version)["received"] #=> "true"
@@ -52,5 +65,13 @@ Example Usage
52
65
  # Now lets show the result for this test version
53
66
  image_url = Litmus::Result.show(test_id, version, 33539350)["result_images"].first["full_image"] #=> "s3.amazonaws.com/resultcaptures/2f21fc9c-08f6-4429-b53d-2e224189526b.fullpageon.png"
54
67
 
68
+ # Let's rename this test to something more intuitive
69
+ Litmus::Test.rename(test_id, 'My email test')
70
+
71
+ # We can later look up the test by this name...
72
+ Litmus::Test.find_by_name('My email test')
73
+
55
74
  system("open http://#{image_url}")
56
- # Looks good!
75
+
76
+ # Looks good! Let's clean up...
77
+ Litmus::Test.destroy(test_id)
data/Rakefile CHANGED
@@ -19,14 +19,13 @@ rescue LoadError
19
19
  puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
20
20
  end
21
21
 
22
- require 'spec/rake/spectask'
23
- Spec::Rake::SpecTask.new(:spec) do |spec|
24
- spec.libs << 'lib' << 'spec'
25
- spec.spec_files = FileList['spec/**/*_spec.rb']
22
+ require 'rspec/core'
23
+ require 'rspec/core/rake_task'
24
+ RSpec::Core::RakeTask.new(:spec) do |spec|
25
+ spec.pattern = 'spec/**/*_spec.rb'
26
26
  end
27
27
 
28
- Spec::Rake::SpecTask.new(:rcov) do |spec|
29
- spec.libs << 'lib' << 'spec'
28
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
30
29
  spec.pattern = 'spec/**/*_spec.rb'
31
30
  spec.rcov = true
32
31
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
@@ -4,14 +4,22 @@ module Litmus
4
4
  super.reject{|test| test["service"] != 'email'}
5
5
  end
6
6
 
7
- def self.create
7
+ def self.create(email={}, name = nil)
8
8
  builder = Builder::XmlMarkup.new
9
9
  builder.instruct! :xml, :version=>"1.0"
10
10
  builder.test_set do |test_set|
11
11
  test_set.use_defaults true
12
12
  test_set.save_defaults false
13
+ test_set.name name if name
14
+
15
+ unless email.empty?
16
+ test_set.email_source do |email_source|
17
+ email_source.subject email[:subject]
18
+ email_source.body email[:body]
19
+ end
20
+ end
13
21
  end
14
22
  post('/emails.xml', :body => builder.target!, :headers => {"Content-type" => "application/xml"})["test_set"]
15
23
  end
16
24
  end
17
- end
25
+ end
@@ -4,14 +4,15 @@ module Litmus
4
4
  super.reject{|test| test["service"] != 'page'}
5
5
  end
6
6
 
7
- def self.create(url)
7
+ def self.create(url, name = nil)
8
8
  builder = Builder::XmlMarkup.new
9
9
  builder.instruct! :xml, :version=>"1.0"
10
10
  builder.test_set do |test_set|
11
11
  test_set.use_defaults true
12
12
  test_set.url url
13
+ test_set.name name if name
13
14
  end
14
15
  post('/pages.xml', :body => builder.target!, :headers => {"Content-type" => "application/xml"})["test_set"]
15
16
  end
16
17
  end
17
- end
18
+ end
data/lib/litmus/test.rb CHANGED
@@ -7,5 +7,22 @@ module Litmus
7
7
  def self.show(id)
8
8
  get("/tests/#{id}.xml")["test_set"]
9
9
  end
10
+
11
+ def self.rename(id, new_name)
12
+ builder = Builder::XmlMarkup.new
13
+ builder.instruct! :xml, :version=>"1.0"
14
+ builder.test_set do |test_set|
15
+ test_set.name new_name
16
+ end
17
+ put("/tests/#{id}.xml", :body => builder.target!, :headers => {"Content-type" => "application/xml"})["test_set"]
18
+ end
19
+
20
+ def self.find_by_name(name)
21
+ self.list.select { |t| t['name'] == name }.first
22
+ end
23
+
24
+ def self.destroy(id)
25
+ delete("/tests/#{id}.xml")
26
+ end
10
27
  end
11
- end
28
+ end
data/litmus.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{litmus}
8
- s.version = "0.1.0"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Matt Fawcett"]
12
- s.date = %q{2010-12-19}
11
+ s.authors = [%q{Matt Fawcett}]
12
+ s.date = %q{2011-09-29}
13
13
  s.description = %q{A wrapper to the Litmus customer API}
14
14
  s.email = %q{mail@matthewfawcett.co.uk}
15
15
  s.extra_rdoc_files = [
@@ -18,6 +18,7 @@ Gem::Specification.new do |s|
18
18
  ]
19
19
  s.files = [
20
20
  ".document",
21
+ ".rspec",
21
22
  "LICENSE",
22
23
  "README.md",
23
24
  "Rakefile",
@@ -38,6 +39,7 @@ Gem::Specification.new do |s|
38
39
  "spec/fixtures/list_results.xml",
39
40
  "spec/fixtures/list_test_versions.xml",
40
41
  "spec/fixtures/poll_test_version.xml",
42
+ "spec/fixtures/rename_test.xml",
41
43
  "spec/fixtures/show_result.xml",
42
44
  "spec/fixtures/show_test.xml",
43
45
  "spec/fixtures/show_test_version.xml",
@@ -49,24 +51,14 @@ Gem::Specification.new do |s|
49
51
  "spec/test_version_spec.rb"
50
52
  ]
51
53
  s.homepage = %q{http://github.com/mattfawcett/litmus}
52
- s.require_paths = ["lib"]
53
- s.rubygems_version = %q{1.3.6}
54
+ s.require_paths = [%q{lib}]
55
+ s.rubygems_version = %q{1.8.6}
54
56
  s.summary = %q{A wrapper to the Litmus customer API}
55
- s.test_files = [
56
- "spec/email_test_spec.rb",
57
- "spec/litmus_spec.rb",
58
- "spec/page_test_spec.rb",
59
- "spec/result_spec.rb",
60
- "spec/spec_helper.rb",
61
- "spec/test_spec.rb",
62
- "spec/test_version_spec.rb"
63
- ]
64
57
 
65
58
  if s.respond_to? :specification_version then
66
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
67
59
  s.specification_version = 3
68
60
 
69
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
61
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
70
62
  s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
71
63
  s.add_runtime_dependency(%q<httparty>, [">= 0.6.1"])
72
64
  else
@@ -11,11 +11,33 @@ describe Litmus::EmailTest do
11
11
  end
12
12
 
13
13
  describe ".create" do
14
- it "should give me back a new email object" do
15
- email_test = Litmus::EmailTest.create
16
- email_test["test_set_versions"].first["version"].should == 1
17
- email_test["test_set_versions"].first["url_or_guid"].should =~ /@emailtests\.com/
18
- email_test["id"].should be_a(Integer)
14
+ context 'without email source' do
15
+ it "should give me back a new email object" do
16
+ Litmus::EmailTest.create
17
+ email_test = Litmus::EmailTest.create({}, 'some name')
18
+ email_test["test_set_versions"].first["version"].should == 1
19
+ email_test["test_set_versions"].first["url_or_guid"].should =~ /@emailtests\.com/
20
+ email_test["id"].should be_a(Integer)
21
+ end
22
+ end
23
+
24
+ context 'with email source' do
25
+ it "should give me back a new email object" do
26
+ email_test = Litmus::EmailTest.create({
27
+ :subject => 'subject',
28
+ :body => 'body',
29
+ }, 'some name')
30
+ email_test["test_set_versions"].first["version"].should == 1
31
+ email_test["test_set_versions"].first["url_or_guid"].should =~ /@emailtests\.com/
32
+ email_test["id"].should be_a(Integer)
33
+ end
34
+ end
35
+ end
36
+
37
+ describe ".find_by_name" do
38
+ it "should return only the test object with the correct name" do
39
+ really_good = Litmus::EmailTest.find_by_name('A really good email')
40
+ really_good["name"].should eql('A really good email')
19
41
  end
20
42
  end
21
- end
43
+ end
@@ -0,0 +1,652 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <test_set>
3
+ <created_at type="datetime">2010-12-19T16:36:59Z</created_at>
4
+ <delta type="boolean">true</delta>
5
+ <id type="integer">1716450</id>
6
+ <updated_at type="datetime">2010-12-19T16:37:01Z</updated_at>
7
+ <name>New name</name>
8
+ <service>email</service>
9
+ <state>waiting</state>
10
+ <public_sharing>false</public_sharing>
11
+ <test_set_versions type="array">
12
+ <test_set_version>
13
+ <version type="integer">1</version>
14
+ <url_or_guid>62e1101@emailtests.com</url_or_guid>
15
+ <received>false</received>
16
+ <source_url>s3.amazonaws.com/sitevista/missing_source</source_url>
17
+ <inline_css></inline_css>
18
+ <results type="array">
19
+ <result>
20
+ <check_state nil="true"></check_state>
21
+ <error_at type="datetime" nil="true"></error_at>
22
+ <finished_at type="datetime" nil="true"></finished_at>
23
+ <id type="integer">33537708</id>
24
+ <started_at type="datetime" nil="true"></started_at>
25
+ <test_code>hotmail</test_code>
26
+ <state>pending</state>
27
+ <result_type>email</result_type>
28
+ <rendered_html_url></rendered_html_url>
29
+ <testing_application>
30
+ <average_time_to_process type="integer">201</average_time_to_process>
31
+ <business>false</business>
32
+ <result_type>email</result_type>
33
+ <supports_content_blocking>false</supports_content_blocking>
34
+ <desktop_client>false</desktop_client>
35
+ <status>0</status>
36
+ <platform_name>Web-based</platform_name>
37
+ <platform_long_name>Web-based</platform_long_name>
38
+ <application_code>hotmail</application_code>
39
+ <application_long_name>Hotmail (Explorer)</application_long_name>
40
+ </testing_application>
41
+ <result_images type="array">
42
+ <result_image>
43
+ <image_type>full_off</image_type>
44
+ </result_image>
45
+ <result_image>
46
+ <image_type>full_on</image_type>
47
+ </result_image>
48
+ <result_image>
49
+ <image_type>window_off</image_type>
50
+ </result_image>
51
+ <result_image>
52
+ <image_type>window_on</image_type>
53
+ </result_image>
54
+ </result_images>
55
+ </result>
56
+ <result>
57
+ <check_state nil="true"></check_state>
58
+ <error_at type="datetime" nil="true"></error_at>
59
+ <finished_at type="datetime" nil="true"></finished_at>
60
+ <id type="integer">33537710</id>
61
+ <started_at type="datetime" nil="true"></started_at>
62
+ <test_code>yahoo</test_code>
63
+ <state>pending</state>
64
+ <result_type>email</result_type>
65
+ <rendered_html_url></rendered_html_url>
66
+ <testing_application>
67
+ <average_time_to_process type="integer">117</average_time_to_process>
68
+ <business>false</business>
69
+ <result_type>email</result_type>
70
+ <supports_content_blocking>true</supports_content_blocking>
71
+ <desktop_client>false</desktop_client>
72
+ <status>0</status>
73
+ <platform_name>Web-based</platform_name>
74
+ <platform_long_name>Web-based</platform_long_name>
75
+ <application_code>yahoo</application_code>
76
+ <application_long_name>Yahoo! Mail (Explorer)</application_long_name>
77
+ </testing_application>
78
+ <result_images type="array">
79
+ <result_image>
80
+ <image_type>full_off</image_type>
81
+ </result_image>
82
+ <result_image>
83
+ <image_type>full_on</image_type>
84
+ </result_image>
85
+ <result_image>
86
+ <image_type>window_off</image_type>
87
+ </result_image>
88
+ <result_image>
89
+ <image_type>window_on</image_type>
90
+ </result_image>
91
+ </result_images>
92
+ </result>
93
+ <result>
94
+ <check_state nil="true"></check_state>
95
+ <error_at type="datetime" nil="true"></error_at>
96
+ <finished_at type="datetime" nil="true"></finished_at>
97
+ <id type="integer">33537712</id>
98
+ <started_at type="datetime" nil="true"></started_at>
99
+ <test_code>ol2000</test_code>
100
+ <state>pending</state>
101
+ <result_type>email</result_type>
102
+ <rendered_html_url></rendered_html_url>
103
+ <testing_application>
104
+ <average_time_to_process type="integer">66</average_time_to_process>
105
+ <business>true</business>
106
+ <result_type>email</result_type>
107
+ <supports_content_blocking>false</supports_content_blocking>
108
+ <desktop_client>true</desktop_client>
109
+ <status>0</status>
110
+ <platform_name>Windows</platform_name>
111
+ <platform_long_name>Microsoft Windows</platform_long_name>
112
+ <application_code>ol2000</application_code>
113
+ <application_long_name>Outlook 2000</application_long_name>
114
+ </testing_application>
115
+ <result_images type="array">
116
+ <result_image>
117
+ <image_type>full_off</image_type>
118
+ </result_image>
119
+ <result_image>
120
+ <image_type>full_on</image_type>
121
+ </result_image>
122
+ <result_image>
123
+ <image_type>window_off</image_type>
124
+ </result_image>
125
+ <result_image>
126
+ <image_type>window_on</image_type>
127
+ </result_image>
128
+ </result_images>
129
+ </result>
130
+ <result>
131
+ <check_state nil="true"></check_state>
132
+ <error_at type="datetime" nil="true"></error_at>
133
+ <finished_at type="datetime" nil="true"></finished_at>
134
+ <id type="integer">33537714</id>
135
+ <started_at type="datetime" nil="true"></started_at>
136
+ <test_code>ol2002</test_code>
137
+ <state>pending</state>
138
+ <result_type>email</result_type>
139
+ <rendered_html_url></rendered_html_url>
140
+ <testing_application>
141
+ <average_time_to_process type="integer">63</average_time_to_process>
142
+ <business>true</business>
143
+ <result_type>email</result_type>
144
+ <supports_content_blocking>false</supports_content_blocking>
145
+ <desktop_client>true</desktop_client>
146
+ <status>0</status>
147
+ <platform_name>Windows</platform_name>
148
+ <platform_long_name>Microsoft Windows</platform_long_name>
149
+ <application_code>ol2002</application_code>
150
+ <application_long_name>Outlook 2002/XP</application_long_name>
151
+ </testing_application>
152
+ <result_images type="array">
153
+ <result_image>
154
+ <image_type>full_off</image_type>
155
+ </result_image>
156
+ <result_image>
157
+ <image_type>full_on</image_type>
158
+ </result_image>
159
+ <result_image>
160
+ <image_type>window_off</image_type>
161
+ </result_image>
162
+ <result_image>
163
+ <image_type>window_on</image_type>
164
+ </result_image>
165
+ </result_images>
166
+ </result>
167
+ <result>
168
+ <check_state nil="true"></check_state>
169
+ <error_at type="datetime" nil="true"></error_at>
170
+ <finished_at type="datetime" nil="true"></finished_at>
171
+ <id type="integer">33537716</id>
172
+ <started_at type="datetime" nil="true"></started_at>
173
+ <test_code>ol2003</test_code>
174
+ <state>pending</state>
175
+ <result_type>email</result_type>
176
+ <rendered_html_url></rendered_html_url>
177
+ <testing_application>
178
+ <average_time_to_process type="integer">165</average_time_to_process>
179
+ <business>true</business>
180
+ <result_type>email</result_type>
181
+ <supports_content_blocking>true</supports_content_blocking>
182
+ <desktop_client>true</desktop_client>
183
+ <status>0</status>
184
+ <platform_name>Windows</platform_name>
185
+ <platform_long_name>Microsoft Windows</platform_long_name>
186
+ <application_code>ol2003</application_code>
187
+ <application_long_name>Outlook 2003</application_long_name>
188
+ </testing_application>
189
+ <result_images type="array">
190
+ <result_image>
191
+ <image_type>full_off</image_type>
192
+ </result_image>
193
+ <result_image>
194
+ <image_type>full_on</image_type>
195
+ </result_image>
196
+ <result_image>
197
+ <image_type>window_off</image_type>
198
+ </result_image>
199
+ <result_image>
200
+ <image_type>window_on</image_type>
201
+ </result_image>
202
+ </result_images>
203
+ </result>
204
+ <result>
205
+ <check_state nil="true"></check_state>
206
+ <error_at type="datetime" nil="true"></error_at>
207
+ <finished_at type="datetime" nil="true"></finished_at>
208
+ <id type="integer">33537718</id>
209
+ <started_at type="datetime" nil="true"></started_at>
210
+ <test_code>ol2007</test_code>
211
+ <state>pending</state>
212
+ <result_type>email</result_type>
213
+ <rendered_html_url></rendered_html_url>
214
+ <testing_application>
215
+ <average_time_to_process type="integer">79</average_time_to_process>
216
+ <business>true</business>
217
+ <result_type>email</result_type>
218
+ <supports_content_blocking>true</supports_content_blocking>
219
+ <desktop_client>true</desktop_client>
220
+ <status>0</status>
221
+ <platform_name>Windows</platform_name>
222
+ <platform_long_name>Microsoft Windows</platform_long_name>
223
+ <application_code>ol2007</application_code>
224
+ <application_long_name>Outlook 2007</application_long_name>
225
+ </testing_application>
226
+ <result_images type="array">
227
+ <result_image>
228
+ <image_type>full_off</image_type>
229
+ </result_image>
230
+ <result_image>
231
+ <image_type>full_on</image_type>
232
+ </result_image>
233
+ <result_image>
234
+ <image_type>window_off</image_type>
235
+ </result_image>
236
+ <result_image>
237
+ <image_type>window_on</image_type>
238
+ </result_image>
239
+ </result_images>
240
+ </result>
241
+ <result>
242
+ <check_state nil="true"></check_state>
243
+ <error_at type="datetime" nil="true"></error_at>
244
+ <finished_at type="datetime" nil="true"></finished_at>
245
+ <id type="integer">33537720</id>
246
+ <started_at type="datetime" nil="true"></started_at>
247
+ <test_code>notes8</test_code>
248
+ <state>pending</state>
249
+ <result_type>email</result_type>
250
+ <rendered_html_url></rendered_html_url>
251
+ <testing_application>
252
+ <average_time_to_process type="integer">141</average_time_to_process>
253
+ <business>true</business>
254
+ <result_type>email</result_type>
255
+ <supports_content_blocking>false</supports_content_blocking>
256
+ <desktop_client>true</desktop_client>
257
+ <status>0</status>
258
+ <platform_name>Windows</platform_name>
259
+ <platform_long_name>Microsoft Windows</platform_long_name>
260
+ <application_code>notes8</application_code>
261
+ <application_long_name>Lotus Notes 8</application_long_name>
262
+ </testing_application>
263
+ <result_images type="array">
264
+ <result_image>
265
+ <image_type>full_off</image_type>
266
+ </result_image>
267
+ <result_image>
268
+ <image_type>full_on</image_type>
269
+ </result_image>
270
+ <result_image>
271
+ <image_type>window_off</image_type>
272
+ </result_image>
273
+ <result_image>
274
+ <image_type>window_on</image_type>
275
+ </result_image>
276
+ </result_images>
277
+ </result>
278
+ <result>
279
+ <check_state nil="true"></check_state>
280
+ <error_at type="datetime" nil="true"></error_at>
281
+ <finished_at type="datetime" nil="true"></finished_at>
282
+ <id type="integer">33537722</id>
283
+ <started_at type="datetime" nil="true"></started_at>
284
+ <test_code>appmail3</test_code>
285
+ <state>pending</state>
286
+ <result_type>email</result_type>
287
+ <rendered_html_url></rendered_html_url>
288
+ <testing_application>
289
+ <average_time_to_process type="integer">163</average_time_to_process>
290
+ <business>false</business>
291
+ <result_type>email</result_type>
292
+ <supports_content_blocking>false</supports_content_blocking>
293
+ <desktop_client>true</desktop_client>
294
+ <status>0</status>
295
+ <platform_name>Mac OS</platform_name>
296
+ <platform_long_name>Mac OS X</platform_long_name>
297
+ <application_code>appmail3</application_code>
298
+ <application_long_name>Apple Mail 3</application_long_name>
299
+ </testing_application>
300
+ <result_images type="array">
301
+ <result_image>
302
+ <image_type>full_off</image_type>
303
+ </result_image>
304
+ <result_image>
305
+ <image_type>full_on</image_type>
306
+ </result_image>
307
+ <result_image>
308
+ <image_type>window_off</image_type>
309
+ </result_image>
310
+ <result_image>
311
+ <image_type>window_on</image_type>
312
+ </result_image>
313
+ </result_images>
314
+ </result>
315
+ <result>
316
+ <check_state nil="true"></check_state>
317
+ <error_at type="datetime" nil="true"></error_at>
318
+ <finished_at type="datetime" nil="true"></finished_at>
319
+ <id type="integer">33537724</id>
320
+ <started_at type="datetime" nil="true"></started_at>
321
+ <test_code>gmailnew</test_code>
322
+ <state>pending</state>
323
+ <result_type>email</result_type>
324
+ <rendered_html_url></rendered_html_url>
325
+ <testing_application>
326
+ <average_time_to_process type="integer">86</average_time_to_process>
327
+ <business>false</business>
328
+ <result_type>email</result_type>
329
+ <supports_content_blocking>true</supports_content_blocking>
330
+ <desktop_client>false</desktop_client>
331
+ <status>0</status>
332
+ <platform_name>Web-based</platform_name>
333
+ <platform_long_name>Web-based</platform_long_name>
334
+ <application_code>gmailnew</application_code>
335
+ <application_long_name>Gmail (Explorer)</application_long_name>
336
+ </testing_application>
337
+ <result_images type="array">
338
+ <result_image>
339
+ <image_type>full_off</image_type>
340
+ </result_image>
341
+ <result_image>
342
+ <image_type>full_on</image_type>
343
+ </result_image>
344
+ <result_image>
345
+ <image_type>window_off</image_type>
346
+ </result_image>
347
+ <result_image>
348
+ <image_type>window_on</image_type>
349
+ </result_image>
350
+ </result_images>
351
+ </result>
352
+ <result>
353
+ <check_state nil="true"></check_state>
354
+ <error_at type="datetime" nil="true"></error_at>
355
+ <finished_at type="datetime" nil="true"></finished_at>
356
+ <id type="integer">33537726</id>
357
+ <started_at type="datetime" nil="true"></started_at>
358
+ <test_code>iphone3</test_code>
359
+ <state>pending</state>
360
+ <result_type>email</result_type>
361
+ <rendered_html_url></rendered_html_url>
362
+ <testing_application>
363
+ <average_time_to_process type="integer">116</average_time_to_process>
364
+ <business>false</business>
365
+ <result_type>email</result_type>
366
+ <supports_content_blocking>false</supports_content_blocking>
367
+ <desktop_client>false</desktop_client>
368
+ <status>0</status>
369
+ <platform_name>Mobile devices</platform_name>
370
+ <platform_long_name>Cell phones and other mobile devices</platform_long_name>
371
+ <application_code>iphone3</application_code>
372
+ <application_long_name>iPhone</application_long_name>
373
+ </testing_application>
374
+ <result_images type="array">
375
+ <result_image>
376
+ <image_type>full_off</image_type>
377
+ </result_image>
378
+ <result_image>
379
+ <image_type>full_on</image_type>
380
+ </result_image>
381
+ <result_image>
382
+ <image_type>window_off</image_type>
383
+ </result_image>
384
+ <result_image>
385
+ <image_type>window_on</image_type>
386
+ </result_image>
387
+ </result_images>
388
+ </result>
389
+ <result>
390
+ <check_state nil="true"></check_state>
391
+ <error_at type="datetime" nil="true"></error_at>
392
+ <finished_at type="datetime" nil="true"></finished_at>
393
+ <id type="integer">33537728</id>
394
+ <started_at type="datetime" nil="true"></started_at>
395
+ <test_code>appmail4</test_code>
396
+ <state>pending</state>
397
+ <result_type>email</result_type>
398
+ <rendered_html_url></rendered_html_url>
399
+ <testing_application>
400
+ <average_time_to_process type="integer">311</average_time_to_process>
401
+ <business>false</business>
402
+ <result_type>email</result_type>
403
+ <supports_content_blocking>false</supports_content_blocking>
404
+ <desktop_client>true</desktop_client>
405
+ <status>0</status>
406
+ <platform_name>Mac OS</platform_name>
407
+ <platform_long_name>Mac OS X</platform_long_name>
408
+ <application_code>appmail4</application_code>
409
+ <application_long_name>Apple Mail 4</application_long_name>
410
+ </testing_application>
411
+ <result_images type="array">
412
+ <result_image>
413
+ <image_type>full_off</image_type>
414
+ </result_image>
415
+ <result_image>
416
+ <image_type>full_on</image_type>
417
+ </result_image>
418
+ <result_image>
419
+ <image_type>window_off</image_type>
420
+ </result_image>
421
+ <result_image>
422
+ <image_type>window_on</image_type>
423
+ </result_image>
424
+ </result_images>
425
+ </result>
426
+ <result>
427
+ <check_state nil="true"></check_state>
428
+ <error_at type="datetime" nil="true"></error_at>
429
+ <finished_at type="datetime" nil="true"></finished_at>
430
+ <id type="integer">33537730</id>
431
+ <started_at type="datetime" nil="true"></started_at>
432
+ <test_code>ol2010</test_code>
433
+ <state>pending</state>
434
+ <result_type>email</result_type>
435
+ <rendered_html_url></rendered_html_url>
436
+ <testing_application>
437
+ <average_time_to_process type="integer">167</average_time_to_process>
438
+ <business>true</business>
439
+ <result_type>email</result_type>
440
+ <supports_content_blocking>true</supports_content_blocking>
441
+ <desktop_client>true</desktop_client>
442
+ <status>0</status>
443
+ <platform_name>Windows</platform_name>
444
+ <platform_long_name>Microsoft Windows</platform_long_name>
445
+ <application_code>ol2010</application_code>
446
+ <application_long_name>Outlook 2010</application_long_name>
447
+ </testing_application>
448
+ <result_images type="array">
449
+ <result_image>
450
+ <image_type>full_off</image_type>
451
+ </result_image>
452
+ <result_image>
453
+ <image_type>full_on</image_type>
454
+ </result_image>
455
+ <result_image>
456
+ <image_type>window_off</image_type>
457
+ </result_image>
458
+ <result_image>
459
+ <image_type>window_on</image_type>
460
+ </result_image>
461
+ </result_images>
462
+ </result>
463
+ <result>
464
+ <check_state nil="true"></check_state>
465
+ <error_at type="datetime" nil="true"></error_at>
466
+ <finished_at type="datetime" nil="true"></finished_at>
467
+ <id type="integer">33537732</id>
468
+ <started_at type="datetime" nil="true"></started_at>
469
+ <test_code>ffgmailnew</test_code>
470
+ <state>pending</state>
471
+ <result_type>email</result_type>
472
+ <rendered_html_url></rendered_html_url>
473
+ <testing_application>
474
+ <average_time_to_process type="integer">97</average_time_to_process>
475
+ <business>false</business>
476
+ <result_type>email</result_type>
477
+ <supports_content_blocking>true</supports_content_blocking>
478
+ <desktop_client>false</desktop_client>
479
+ <status>0</status>
480
+ <platform_name>Web-based</platform_name>
481
+ <platform_long_name>Web-based</platform_long_name>
482
+ <application_code>ffgmailnew</application_code>
483
+ <application_long_name>Gmail (Firefox)</application_long_name>
484
+ </testing_application>
485
+ <result_images type="array">
486
+ <result_image>
487
+ <image_type>full_off</image_type>
488
+ </result_image>
489
+ <result_image>
490
+ <image_type>full_on</image_type>
491
+ </result_image>
492
+ <result_image>
493
+ <image_type>window_off</image_type>
494
+ </result_image>
495
+ <result_image>
496
+ <image_type>window_on</image_type>
497
+ </result_image>
498
+ </result_images>
499
+ </result>
500
+ <result>
501
+ <check_state nil="true"></check_state>
502
+ <error_at type="datetime" nil="true"></error_at>
503
+ <finished_at type="datetime" nil="true"></finished_at>
504
+ <id type="integer">33537734</id>
505
+ <started_at type="datetime" nil="true"></started_at>
506
+ <test_code>ffhotmail</test_code>
507
+ <state>pending</state>
508
+ <result_type>email</result_type>
509
+ <rendered_html_url></rendered_html_url>
510
+ <testing_application>
511
+ <average_time_to_process type="integer">503</average_time_to_process>
512
+ <business>false</business>
513
+ <result_type>email</result_type>
514
+ <supports_content_blocking>false</supports_content_blocking>
515
+ <desktop_client>false</desktop_client>
516
+ <status>0</status>
517
+ <platform_name>Web-based</platform_name>
518
+ <platform_long_name>Web-based</platform_long_name>
519
+ <application_code>ffhotmail</application_code>
520
+ <application_long_name>Hotmail (Firefox)</application_long_name>
521
+ </testing_application>
522
+ <result_images type="array">
523
+ <result_image>
524
+ <image_type>full_off</image_type>
525
+ </result_image>
526
+ <result_image>
527
+ <image_type>full_on</image_type>
528
+ </result_image>
529
+ <result_image>
530
+ <image_type>window_off</image_type>
531
+ </result_image>
532
+ <result_image>
533
+ <image_type>window_on</image_type>
534
+ </result_image>
535
+ </result_images>
536
+ </result>
537
+ <result>
538
+ <check_state nil="true"></check_state>
539
+ <error_at type="datetime" nil="true"></error_at>
540
+ <finished_at type="datetime" nil="true"></finished_at>
541
+ <id type="integer">33537736</id>
542
+ <started_at type="datetime" nil="true"></started_at>
543
+ <test_code>ffaolonline</test_code>
544
+ <state>pending</state>
545
+ <result_type>email</result_type>
546
+ <rendered_html_url></rendered_html_url>
547
+ <testing_application>
548
+ <average_time_to_process type="integer">222</average_time_to_process>
549
+ <business>false</business>
550
+ <result_type>email</result_type>
551
+ <supports_content_blocking>true</supports_content_blocking>
552
+ <desktop_client>false</desktop_client>
553
+ <status>0</status>
554
+ <platform_name>Web-based</platform_name>
555
+ <platform_long_name>Web-based</platform_long_name>
556
+ <application_code>ffaolonline</application_code>
557
+ <application_long_name>AOL Mail (Firefox)</application_long_name>
558
+ </testing_application>
559
+ <result_images type="array">
560
+ <result_image>
561
+ <image_type>full_off</image_type>
562
+ </result_image>
563
+ <result_image>
564
+ <image_type>full_on</image_type>
565
+ </result_image>
566
+ <result_image>
567
+ <image_type>window_off</image_type>
568
+ </result_image>
569
+ <result_image>
570
+ <image_type>window_on</image_type>
571
+ </result_image>
572
+ </result_images>
573
+ </result>
574
+ <result>
575
+ <check_state nil="true"></check_state>
576
+ <error_at type="datetime" nil="true"></error_at>
577
+ <finished_at type="datetime" nil="true"></finished_at>
578
+ <id type="integer">33537738</id>
579
+ <started_at type="datetime" nil="true"></started_at>
580
+ <test_code>ffyahoo</test_code>
581
+ <state>pending</state>
582
+ <result_type>email</result_type>
583
+ <rendered_html_url></rendered_html_url>
584
+ <testing_application>
585
+ <average_time_to_process type="integer">120</average_time_to_process>
586
+ <business>false</business>
587
+ <result_type>email</result_type>
588
+ <supports_content_blocking>true</supports_content_blocking>
589
+ <desktop_client>false</desktop_client>
590
+ <status>0</status>
591
+ <platform_name>Web-based</platform_name>
592
+ <platform_long_name>Web-based</platform_long_name>
593
+ <application_code>ffyahoo</application_code>
594
+ <application_long_name>Yahoo! Mail (Firefox)</application_long_name>
595
+ </testing_application>
596
+ <result_images type="array">
597
+ <result_image>
598
+ <image_type>full_off</image_type>
599
+ </result_image>
600
+ <result_image>
601
+ <image_type>full_on</image_type>
602
+ </result_image>
603
+ <result_image>
604
+ <image_type>window_off</image_type>
605
+ </result_image>
606
+ <result_image>
607
+ <image_type>window_on</image_type>
608
+ </result_image>
609
+ </result_images>
610
+ </result>
611
+ <result>
612
+ <check_state nil="true"></check_state>
613
+ <error_at type="datetime" nil="true"></error_at>
614
+ <finished_at type="datetime" nil="true"></finished_at>
615
+ <id type="integer">33537740</id>
616
+ <started_at type="datetime" nil="true"></started_at>
617
+ <test_code>ipad3</test_code>
618
+ <state>pending</state>
619
+ <result_type>email</result_type>
620
+ <rendered_html_url></rendered_html_url>
621
+ <testing_application>
622
+ <average_time_to_process type="integer">137</average_time_to_process>
623
+ <business>false</business>
624
+ <result_type>email</result_type>
625
+ <supports_content_blocking>false</supports_content_blocking>
626
+ <desktop_client>false</desktop_client>
627
+ <status>0</status>
628
+ <platform_name>Mobile devices</platform_name>
629
+ <platform_long_name>Cell phones and other mobile devices</platform_long_name>
630
+ <application_code>ipad3</application_code>
631
+ <application_long_name>iPad</application_long_name>
632
+ </testing_application>
633
+ <result_images type="array">
634
+ <result_image>
635
+ <image_type>full_off</image_type>
636
+ </result_image>
637
+ <result_image>
638
+ <image_type>full_on</image_type>
639
+ </result_image>
640
+ <result_image>
641
+ <image_type>window_off</image_type>
642
+ </result_image>
643
+ <result_image>
644
+ <image_type>window_on</image_type>
645
+ </result_image>
646
+ </result_images>
647
+ </result>
648
+ </results>
649
+ </test_set_version>
650
+ </test_set_versions>
651
+ <url_or_guid>62e1101</url_or_guid>
652
+ </test_set>
@@ -12,8 +12,16 @@ describe Litmus::PageTest do
12
12
 
13
13
  describe ".create" do
14
14
  it "should give me back a new page object" do
15
- page_test = Litmus::PageTest.create("http://matthewfawcett.co.uk/")
15
+ Litmus::PageTest.create("http://matthewfawcett.co.uk/")
16
+ page_test = Litmus::PageTest.create("http://matthewfawcett.co.uk/", 'some name')
16
17
  page_test["id"].should == 1716444
17
18
  end
18
19
  end
19
- end
20
+
21
+ describe ".find_by_name" do
22
+ it "should return only the test object with the correct name" do
23
+ home = Litmus::PageTest.find_by_name('Home | Real Ale Hunter')
24
+ home["name"].should eql("Home | Real Ale Hunter")
25
+ end
26
+ end
27
+ end
data/spec/spec_helper.rb CHANGED
@@ -7,7 +7,7 @@ require 'rspec/autorun'
7
7
  require 'fakeweb'
8
8
  FakeWeb.allow_net_connect = false
9
9
 
10
- Rspec.configure do |config|
10
+ RSpec.configure do |config|
11
11
  FakeWeb.register_uri(:get, 'http://matt:yourpassword@matthewfawcett.litmus.com/tests.xml',
12
12
  :body => File.join(File.dirname(__FILE__), 'fixtures', 'all_tests.xml'),
13
13
  :content_type => "text/xml")
@@ -20,6 +20,11 @@ Rspec.configure do |config|
20
20
  FakeWeb.register_uri(:get, 'http://matt:yourpassword@matthewfawcett.litmus.com/tests/1716450.xml',
21
21
  :body => File.join(File.dirname(__FILE__), 'fixtures', 'show_test.xml'),
22
22
  :content_type => "text/xml")
23
+ FakeWeb.register_uri(:delete, 'http://matt:yourpassword@matthewfawcett.litmus.com/tests/1716450.xml',
24
+ :status => [200, 'OK'], :content_type => "text/xml")
25
+ FakeWeb.register_uri(:put, 'http://matt:yourpassword@matthewfawcett.litmus.com/tests/1716450.xml',
26
+ :body => File.join(File.dirname(__FILE__), 'fixtures', 'rename_test.xml'),
27
+ :content_type => "text/xml")
23
28
  FakeWeb.register_uri(:get, 'http://matt:yourpassword@matthewfawcett.litmus.com/tests/1716450/versions/1.xml',
24
29
  :body => File.join(File.dirname(__FILE__), 'fixtures', 'show_test_version.xml'),
25
30
  :content_type => "text/xml")
@@ -41,4 +46,4 @@ Rspec.configure do |config|
41
46
  config.before(:each) do
42
47
  Litmus::Base.new("matthewfawcett", "matt", "yourpassword")
43
48
  end
44
- end
49
+ end
data/spec/test_spec.rb CHANGED
@@ -7,4 +7,18 @@ describe Litmus::Test do
7
7
  test["id"].should == 1716450
8
8
  end
9
9
  end
10
- end
10
+
11
+ describe ".rename" do
12
+ it "should respond with the new name" do
13
+ test = Litmus::Test.rename(1716450, 'New name')
14
+ test['name'].should == 'New name'
15
+ end
16
+ end
17
+
18
+ describe ".destroy" do
19
+ it "should send a delete request for the given id" do
20
+ response = Litmus::Test.destroy(1716450)
21
+ FakeWeb.last_request.method.should eql 'DELETE'
22
+ end
23
+ end
24
+ end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: litmus
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ hash: 23
5
+ prerelease:
5
6
  segments:
6
7
  - 0
7
- - 1
8
+ - 2
8
9
  - 0
9
- version: 0.1.0
10
+ version: 0.2.0
10
11
  platform: ruby
11
12
  authors:
12
13
  - Matt Fawcett
@@ -14,16 +15,17 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-12-19 00:00:00 +00:00
18
- default_executable:
18
+ date: 2011-09-29 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rspec
22
22
  prerelease: false
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
24
25
  requirements:
25
26
  - - ">="
26
27
  - !ruby/object:Gem::Version
28
+ hash: 13
27
29
  segments:
28
30
  - 1
29
31
  - 2
@@ -35,9 +37,11 @@ dependencies:
35
37
  name: httparty
36
38
  prerelease: false
37
39
  requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
38
41
  requirements:
39
42
  - - ">="
40
43
  - !ruby/object:Gem::Version
44
+ hash: 5
41
45
  segments:
42
46
  - 0
43
47
  - 6
@@ -56,6 +60,7 @@ extra_rdoc_files:
56
60
  - README.md
57
61
  files:
58
62
  - .document
63
+ - .rspec
59
64
  - LICENSE
60
65
  - README.md
61
66
  - Rakefile
@@ -76,6 +81,7 @@ files:
76
81
  - spec/fixtures/list_results.xml
77
82
  - spec/fixtures/list_test_versions.xml
78
83
  - spec/fixtures/poll_test_version.xml
84
+ - spec/fixtures/rename_test.xml
79
85
  - spec/fixtures/show_result.xml
80
86
  - spec/fixtures/show_test.xml
81
87
  - spec/fixtures/show_test_version.xml
@@ -85,7 +91,6 @@ files:
85
91
  - spec/spec_helper.rb
86
92
  - spec/test_spec.rb
87
93
  - spec/test_version_spec.rb
88
- has_rdoc: true
89
94
  homepage: http://github.com/mattfawcett/litmus
90
95
  licenses: []
91
96
 
@@ -95,31 +100,29 @@ rdoc_options: []
95
100
  require_paths:
96
101
  - lib
97
102
  required_ruby_version: !ruby/object:Gem::Requirement
103
+ none: false
98
104
  requirements:
99
105
  - - ">="
100
106
  - !ruby/object:Gem::Version
107
+ hash: 3
101
108
  segments:
102
109
  - 0
103
110
  version: "0"
104
111
  required_rubygems_version: !ruby/object:Gem::Requirement
112
+ none: false
105
113
  requirements:
106
114
  - - ">="
107
115
  - !ruby/object:Gem::Version
116
+ hash: 3
108
117
  segments:
109
118
  - 0
110
119
  version: "0"
111
120
  requirements: []
112
121
 
113
122
  rubyforge_project:
114
- rubygems_version: 1.3.6
123
+ rubygems_version: 1.8.6
115
124
  signing_key:
116
125
  specification_version: 3
117
126
  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
127
+ test_files: []
128
+