Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adds optional parameter to set test name during creation

  • Loading branch information...
commit 745976077db91f6c060febd29307efdd929f5430 1 parent d7f4a76
@logankoester logankoester authored
View
5 README.md
@@ -8,14 +8,13 @@ Currently Implmented
* Litmus::EmailTest.list
* Litmus::EmailTest.show(id)
* Litmus::EmailTest.find_by_name(name)
-* Litmus::EmailTest.create
-* Litmus::EmailTest.create({:subject => '', :body => ''})
+* Litmus::EmailTest.create({:subject => '', :body => ''}, name = nil)
* Litmus::EmailTest.rename(id, new_name)
* Litmus::EmailTest.destroy(id)
* Litmus::PageTest.list
* Litmus::PageTest.show(id)
* Litmus::PageTest.find_by_name(name)
-* Litmus::PageTest.create(url)
+* Litmus::PageTest.create(url, name = nil)
* Litmus::PageTest.rename(id, new_name)
* Litmus::PageTest.destroy(id)
* Litmus::TestVersion.list(test_id)
View
3  lib/litmus/email_test.rb
@@ -4,12 +4,13 @@ def self.list
super.reject{|test| test["service"] != 'email'}
end
- def self.create(email={})
+ def self.create(email={}, name = nil)
builder = Builder::XmlMarkup.new
builder.instruct! :xml, :version=>"1.0"
builder.test_set do |test_set|
test_set.use_defaults true
test_set.save_defaults false
+ test_set.name name if name
unless email.empty?
test_set.email_source do |email_source|
View
5 lib/litmus/page_test.rb
@@ -4,14 +4,15 @@ def self.list
super.reject{|test| test["service"] != 'page'}
end
- def self.create(url)
+ def self.create(url, name = nil)
builder = Builder::XmlMarkup.new
builder.instruct! :xml, :version=>"1.0"
builder.test_set do |test_set|
test_set.use_defaults true
test_set.url url
+ test_set.name name if name
end
post('/pages.xml', :body => builder.target!, :headers => {"Content-type" => "application/xml"})["test_set"]
end
end
-end
+end
View
5 spec/email_test_spec.rb
@@ -13,7 +13,8 @@
describe ".create" do
context 'without email source' do
it "should give me back a new email object" do
- email_test = Litmus::EmailTest.create
+ Litmus::EmailTest.create
+ email_test = Litmus::EmailTest.create({}, 'some name')
email_test["test_set_versions"].first["version"].should == 1
email_test["test_set_versions"].first["url_or_guid"].should =~ /@emailtests\.com/
email_test["id"].should be_a(Integer)
@@ -25,7 +26,7 @@
email_test = Litmus::EmailTest.create({
:subject => 'subject',
:body => 'body',
- })
+ }, 'some name')
email_test["test_set_versions"].first["version"].should == 1
email_test["test_set_versions"].first["url_or_guid"].should =~ /@emailtests\.com/
email_test["id"].should be_a(Integer)
View
3  spec/page_test_spec.rb
@@ -12,7 +12,8 @@
describe ".create" do
it "should give me back a new page object" do
- page_test = Litmus::PageTest.create("http://matthewfawcett.co.uk/")
+ Litmus::PageTest.create("http://matthewfawcett.co.uk/")
+ page_test = Litmus::PageTest.create("http://matthewfawcett.co.uk/", 'some name')
page_test["id"].should == 1716444
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.