Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

more spec testing

  • Loading branch information...
commit aa16fd3e0369c2cf65d95e64c006ba74ef6b9383 1 parent 6ba618d
@nohat authored
View
19 spec/controllers/pronunciations_controller_spec.rb
@@ -0,0 +1,19 @@
+require 'spec_helper'
+
+describe PronunciationsController do
+ describe "GET index with no parameters" do
+ before do
+ Factory(:word_with_pronunciation)
+ get :index
+ end
+
+ it "is successful" do
+ response.should be_successful
+ end
+
+ it "gets pronunciations" do
+ assigns(:pronunciations).should_not be_empty
+ end
+ end
+
+end
View
3  spec/factories/pronunciation_factory.rb
@@ -0,0 +1,3 @@
+Factory.define :pronunciation do |pronunciation|
+ pronunciation.arpabet 'P R OW0 N AH2 N S IY0 EY1 SH AH0 N'
+end
View
9 spec/factories/word_factory.rb
@@ -0,0 +1,9 @@
+Factory.define :word do |word|
+ word.name 'testword'
+end
+
+Factory.define :word_with_pronunciation, :parent => :word do |word|
+ word.pronunciations do
+ [Factory(:pronunciation)]
+ end
+end
View
11 spec/factories/words_factory.rb
@@ -1,11 +0,0 @@
-Factory.define :word do |word|
- word.name 'testword'
-end
-
-Factory.define :word_with_pronunciation, :parent => :word do |word|
-#word.pronunciations = [Factory :pronunciation]
-end
-
-Factory.define :pronunciation do |pronunciation|
- pronunciation.arpabet 'P R OW0 N AH2 N S IY0 EY1 SH AH0 N'
-end
View
2  spec/models/word_spec.rb
@@ -22,6 +22,6 @@
exact_match = Factory :word, :name => 'exact_match'
@matches = Word.spelling_matches 'exact_match'
@results = @matches.map { |match| match[:result] }
- @results.should be [exact_match, inexact_match]
+ @results.should == [exact_match, inexact_match]
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.