Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

using Rayt

  • Loading branch information...
commit f1fb4294e1837bb3686305e4f7da3698da4e664d 1 parent dd3283f
@thoferon authored
View
2  Gemfile.lock
@@ -34,6 +34,7 @@ GEM
mime-types (1.18)
posix-spawn (0.3.6)
rake (0.9.2.2)
+ rayt (0.0.1)
rspec (2.10.0)
rspec-core (~> 2.10.0)
rspec-expectations (~> 2.10.0)
@@ -51,4 +52,5 @@ DEPENDENCIES
aruba
cucumber
git_farm!
+ rayt
rspec
View
1  git_farm.gemspec
@@ -18,6 +18,7 @@ Gem::Specification.new do |s|
s.add_development_dependency "cucumber"
s.add_development_dependency "rspec"
s.add_development_dependency "aruba"
+ s.add_development_dependency "rayt"
s.files = `git ls-files`.split("\n").reject { |path| path =~ /\.gitignore$/ }
s.test_files = `git ls-files -- {spec,features}/*`.split("\n")
View
30 spec/lib/git_farm/application_spec.rb
@@ -1,3 +1,4 @@
+require "rayt"
require "git_farm/application"
describe GitFarm::Application do
@@ -18,26 +19,19 @@
end
describe "#run" do
- def should_call(method_name)
- class << (checker = Object.new)
- attr_accessor :method_name
- def with_command(command)
- args_count = command == "list" ? 0 :
- (command == "rename" ? 2 : 1)
- farm = GitFarm::Farm.new
- GitFarm::Farm.stub(:new).and_return(farm)
- farm.should_receive(method_name).and_return([])
- GitFarm::Application.new.run("#{command}", *Array.new(args_count, "sth"))
- end
- end
- checker.method_name = method_name
- checker
+ Rayt.define.should_call(:method_name).with_command(:command) do |r|
+ args_count = r.command == "list" ? 0 :
+ (r.command == "rename" ? 2 : 1)
+ farm = GitFarm::Farm.new
+ GitFarm::Farm.stub(:new).and_return(farm)
+ farm.should_receive(r.method_name).and_return([])
+ GitFarm::Application.new.run("#{r.command}", *Array.new(args_count, "sth"))
end
- it { should_call(:create_repository).with_command("create") }
- it { should_call(:delete_repository).with_command("delete") }
- it { should_call(:rename_repository).with_command("rename") }
- it { should_call(:repositories).with_command("list") }
+ it { Rayt.should_call(:create_repository).with_command("create") }
+ it { Rayt.should_call(:delete_repository).with_command("delete") }
+ it { Rayt.should_call(:rename_repository).with_command("rename") }
+ it { Rayt.should_call(:repositories).with_command("list") }
it "should display help if the command doesn't exist" do
subject.should_receive(:display_help)
Please sign in to comment.
Something went wrong with that request. Please try again.