Created
August 1, 2013 12:46
-
-
Save eduardocl/6131013 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe "#list" do | |
it "list attribute as ruby object" do | |
attrs = @controller.list_attributes | |
attrs.each do |a| | |
a.should be_an_instance_of Attribute | |
end | |
end | |
it "list attribute in xml format" do | |
xml = @controller.list_attributes(:xml) | |
puts xml | |
attrs = Nokogiri::XML(xml) | |
attrs.root.search('attribute').should have(2).attributes | |
#for attribute field we test the values from | |
#the previous two attributes tested | |
test_attrs_values = { | |
'name' => ['email', 'num_of_bugs'], | |
'label' => ['Email', 'Num. of Bugs'], | |
'type' => ['numerical', 'alphanumerical'] | |
} | |
test_attrs_values.each do |field, values| | |
attrs.xpath("//#{field}").each do |f| | |
values.should include(f.content) | |
end | |
end | |
end | |
it "list attributes in json format" do | |
json_data = @controller.list_attributes(:json) | |
#puts json_data | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment