-
-
Save robotarmy/899905 to your computer and use it in GitHub Desktop.
test
This file contains hidden or 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
require 'spec_helper' | |
describe FeedbackController do | |
describe "actions" do | |
it "#create" do | |
questions = ['what do you like most?','what is your favorite colour?'], | |
answers = ['I like life!', 'I like green'], | |
comment = %%Blue is also nice, Red is the colour of blood, tomatoes, | |
and sunsets over the ocean when the light is just right%, | |
page_url = %%http://url% | |
lambda do | |
post :create ,:feedback => { | |
:questions => questions, | |
:answers => answers, | |
:comment => comment, | |
:page_url => page_url | |
} | |
end.should change(Feedback,:count).by(1) | |
feedback = Feedback.last | |
feedback.answers.should == answers | |
feedback.questions.should == questions | |
feedback.comment.should == comment | |
feedback.page_url.should == page_url | |
feedback.created_at.should_not be_nil | |
end | |
end | |
end |
This file contains hidden or 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
require 'spec_helper' | |
describe 'Feedback form' do | |
it "has a feedback link in the title" do | |
visit root_path | |
click_on "Give us Feeback" | |
lambda do | |
fill_in 'feedback[answers][]', :with => 'I like green' | |
fill_in 'feedback[answers][]', :with => 'The font is ok' | |
fill_in 'feedback[answers][]', :with => 'Add a delete button' | |
comment =%% | |
This is my feeback that is longer | |
I would like it to be greater than 255 characters | |
and all that #{"*" * 255}% | |
fill_in 'feedback[comments]', :with => comment | |
click_on 'Send Feeback' | |
end.should change(Feedback,:count).by(1) | |
Feedback.last.page_url.should == root_path | |
Feedback.last.questions.should_not be_nil | |
Feedback.last.questions.should_not be_empty | |
end | |
it "changes the root path" do | |
end | |
describe "as logged in" do | |
let(:steward) do | |
Factory(:steward) | |
end | |
before do | |
steward | |
end | |
end | |
describe "when not logged in" do | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment