spec/rapidash/resourceable_spec.rb in rapidash-0.0.5 vs spec/rapidash/resourceable_spec.rb in rapidash-0.0.6
- old
+ new
@@ -26,10 +26,15 @@
class Rapidash::ClientTester
include Rapidash::Resourceable
resource :users
end
+class Rapidash::MultiResourceTester
+ include Rapidash::Resourceable
+ resource :users, :repos
+end
+
class ClientTester
include Rapidash::Resourceable
resource :users
end
@@ -47,9 +52,14 @@
Rapidash::ClientTester.new.methods.map { |m| m.to_sym }.should include(:users)
end
it "should add a bang method with the name of the argument" do
Rapidash::ClientTester.new.methods.map { |m| m.to_sym }.should include(:users!)
+ end
+
+ it "should add a method for each resource is an array is passed" do
+ methods = Rapidash::MultiResourceTester.new.methods.map { |m| m.to_sym }
+ (methods & [:users, :users!, :repos, :repos!]).length.should eql(4)
end
end
describe ".users" do
it "should return an instance of the resource" do