Permalink
Browse files

Introduce RSpec

  • Loading branch information...
1 parent d6eec61 commit d45cb33be7ccae37d4f85a1f172342e6ef9efe81 @eraserhd eraserhd committed Dec 30, 2011
Showing with 34 additions and 9 deletions.
  1. +1 −0 Gemfile
  2. +10 −0 Gemfile.lock
  3. +4 −1 Rakefile
  4. +19 −0 spec/shortcuts_spec.rb
  5. +0 −8 test/shortcuts_test.rb
View
@@ -4,6 +4,7 @@ group :development do
gem 'bundler', '~> 1.0.0'
gem 'jeweler', '~> 1.6.4'
gem 'rcov', '>= 0'
+ gem 'rspec', '~> 2.7.0'
gem 'flexmock'
end
View
@@ -1,6 +1,7 @@
GEM
remote: http://rubygems.org/
specs:
+ diff-lcs (1.1.3)
flexmock (0.9.0)
git (1.2.5)
jeweler (1.6.4)
@@ -9,6 +10,14 @@ GEM
rake
rake (0.9.2.2)
rcov (0.9.11)
+ rspec (2.7.0)
+ rspec-core (~> 2.7.0)
+ rspec-expectations (~> 2.7.0)
+ rspec-mocks (~> 2.7.0)
+ rspec-core (2.7.1)
+ rspec-expectations (2.7.0)
+ diff-lcs (~> 1.1.2)
+ rspec-mocks (2.7.0)
PLATFORMS
ruby
@@ -18,3 +27,4 @@ DEPENDENCIES
flexmock
jeweler (~> 1.6.4)
rcov
+ rspec (~> 2.7.0)
View
@@ -32,6 +32,9 @@ Rake::TestTask.new(:test) do |test|
test.verbose = true
end
+require 'rspec/core/rake_task'
+RSpec::Core::RakeTask.new(:spec)
+
require 'rcov/rcovtask'
Rcov::RcovTask.new do |test|
test.libs << 'test'
@@ -40,7 +43,7 @@ Rcov::RcovTask.new do |test|
test.rcov_opts << '--exclude "gems/*"'
end
-task :default => :test
+task :default => [:spec, :test]
begin
require 'rdoc/task'
View
@@ -0,0 +1,19 @@
+require 'zerg_xcode'
+
+describe ZergXcode do
+
+ context "when loading a file" do
+
+ subject {ZergXcode.load 'test/fixtures/ZergSupport'}
+
+ it "should find the targets" do
+ targets = subject['targets'].map{ |target| target['name'] }.sort
+ targets.should == ['ZergSupport', 'ZergTestSupport', 'ZergSupportTests'].sort
+ end
+
+ it "should set the project's source filename" do
+ subject.source_filename.should == 'test/fixtures/ZergSupport.xcodeproj/project.pbxproj'
+ end
+ end
+
+end
View
@@ -6,14 +6,6 @@
require 'test/unit'
class ShortcutsTest < Test::Unit::TestCase
- def test_load
- proj = ZergXcode.load 'test/fixtures/ZergSupport'
- assert_equal ['ZergSupport', 'ZergTestSupport', 'ZergSupportTests'].sort,
- proj['targets'].map { |target| target['name'] }.sort
- assert_equal 'test/fixtures/ZergSupport.xcodeproj/project.pbxproj',
- proj.source_filename, 'Loading did not set project source'
- end
-
def test_plugin
ls_instance = ZergXcode.plugin 'ls'
ls_class = ZergXcode::Plugins::Ls

0 comments on commit d45cb33

Please sign in to comment.