AutoCommit Don Jul 30 00:03:02 CEST 2015

This commit is contained in:
Andreas Stephanides
2015-07-30 00:03:02 +02:00
parent 068c2a2e55
commit 97df081b33
66 changed files with 1542 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
require 'rails_helper'
RSpec.describe "survey/answers/edit", :type => :view do
before(:each) do
@survey_answer = assign(:survey_answer, Survey::Answer.create!(
:choice => nil,
:user => nil
))
end
it "renders the edit survey_answer form" do
render
assert_select "form[action=?][method=?]", survey_answer_path(@survey_answer), "post" do
assert_select "input#survey_answer_choice[name=?]", "survey_answer[choice]"
assert_select "input#survey_answer_user[name=?]", "survey_answer[user]"
end
end
end

View File

@@ -0,0 +1,22 @@
require 'rails_helper'
RSpec.describe "survey/answers/index", :type => :view do
before(:each) do
assign(:survey_answers, [
Survey::Answer.create!(
:choice => nil,
:user => nil
),
Survey::Answer.create!(
:choice => nil,
:user => nil
)
])
end
it "renders a list of survey/answers" do
render
assert_select "tr>td", :text => nil.to_s, :count => 2
assert_select "tr>td", :text => nil.to_s, :count => 2
end
end

View File

@@ -0,0 +1,21 @@
require 'rails_helper'
RSpec.describe "survey/answers/new", :type => :view do
before(:each) do
assign(:survey_answer, Survey::Answer.new(
:choice => nil,
:user => nil
))
end
it "renders new survey_answer form" do
render
assert_select "form[action=?][method=?]", survey_answers_path, "post" do
assert_select "input#survey_answer_choice[name=?]", "survey_answer[choice]"
assert_select "input#survey_answer_user[name=?]", "survey_answer[user]"
end
end
end

View File

@@ -0,0 +1,16 @@
require 'rails_helper'
RSpec.describe "survey/answers/show", :type => :view do
before(:each) do
@survey_answer = assign(:survey_answer, Survey::Answer.create!(
:choice => nil,
:user => nil
))
end
it "renders attributes in <p>" do
render
expect(rendered).to match(//)
expect(rendered).to match(//)
end
end

View File

@@ -0,0 +1,27 @@
require 'rails_helper'
RSpec.describe "survey/choices/edit", :type => :view do
before(:each) do
@survey_choice = assign(:survey_choice, Survey::Choice.create!(
:text => "MyString",
:question => nil,
:sort => 1,
:picture => "MyString"
))
end
it "renders the edit survey_choice form" do
render
assert_select "form[action=?][method=?]", survey_choice_path(@survey_choice), "post" do
assert_select "input#survey_choice_text[name=?]", "survey_choice[text]"
assert_select "input#survey_choice_question[name=?]", "survey_choice[question]"
assert_select "input#survey_choice_sort[name=?]", "survey_choice[sort]"
assert_select "input#survey_choice_picture[name=?]", "survey_choice[picture]"
end
end
end

View File

@@ -0,0 +1,28 @@
require 'rails_helper'
RSpec.describe "survey/choices/index", :type => :view do
before(:each) do
assign(:survey_choices, [
Survey::Choice.create!(
:text => "Text",
:question => nil,
:sort => 1,
:picture => "Picture"
),
Survey::Choice.create!(
:text => "Text",
:question => nil,
:sort => 1,
:picture => "Picture"
)
])
end
it "renders a list of survey/choices" do
render
assert_select "tr>td", :text => "Text".to_s, :count => 2
assert_select "tr>td", :text => nil.to_s, :count => 2
assert_select "tr>td", :text => 1.to_s, :count => 2
assert_select "tr>td", :text => "Picture".to_s, :count => 2
end
end

View File

@@ -0,0 +1,27 @@
require 'rails_helper'
RSpec.describe "survey/choices/new", :type => :view do
before(:each) do
assign(:survey_choice, Survey::Choice.new(
:text => "MyString",
:question => nil,
:sort => 1,
:picture => "MyString"
))
end
it "renders new survey_choice form" do
render
assert_select "form[action=?][method=?]", survey_choices_path, "post" do
assert_select "input#survey_choice_text[name=?]", "survey_choice[text]"
assert_select "input#survey_choice_question[name=?]", "survey_choice[question]"
assert_select "input#survey_choice_sort[name=?]", "survey_choice[sort]"
assert_select "input#survey_choice_picture[name=?]", "survey_choice[picture]"
end
end
end

View File

@@ -0,0 +1,20 @@
require 'rails_helper'
RSpec.describe "survey/choices/show", :type => :view do
before(:each) do
@survey_choice = assign(:survey_choice, Survey::Choice.create!(
:text => "Text",
:question => nil,
:sort => 1,
:picture => "Picture"
))
end
it "renders attributes in <p>" do
render
expect(rendered).to match(/Text/)
expect(rendered).to match(//)
expect(rendered).to match(/1/)
expect(rendered).to match(/Picture/)
end
end

View File

@@ -0,0 +1,24 @@
require 'rails_helper'
RSpec.describe "survey/questions/edit", :type => :view do
before(:each) do
@survey_question = assign(:survey_question, Survey::Question.create!(
:title => "MyString",
:text => "MyText",
:typ => 1
))
end
it "renders the edit survey_question form" do
render
assert_select "form[action=?][method=?]", survey_question_path(@survey_question), "post" do
assert_select "input#survey_question_title[name=?]", "survey_question[title]"
assert_select "textarea#survey_question_text[name=?]", "survey_question[text]"
assert_select "input#survey_question_typ[name=?]", "survey_question[typ]"
end
end
end

View File

@@ -0,0 +1,25 @@
require 'rails_helper'
RSpec.describe "survey/questions/index", :type => :view do
before(:each) do
assign(:survey_questions, [
Survey::Question.create!(
:title => "Title",
:text => "MyText",
:typ => 1
),
Survey::Question.create!(
:title => "Title",
:text => "MyText",
:typ => 1
)
])
end
it "renders a list of survey/questions" do
render
assert_select "tr>td", :text => "Title".to_s, :count => 2
assert_select "tr>td", :text => "MyText".to_s, :count => 2
assert_select "tr>td", :text => 1.to_s, :count => 2
end
end

View File

@@ -0,0 +1,24 @@
require 'rails_helper'
RSpec.describe "survey/questions/new", :type => :view do
before(:each) do
assign(:survey_question, Survey::Question.new(
:title => "MyString",
:text => "MyText",
:typ => 1
))
end
it "renders new survey_question form" do
render
assert_select "form[action=?][method=?]", survey_questions_path, "post" do
assert_select "input#survey_question_title[name=?]", "survey_question[title]"
assert_select "textarea#survey_question_text[name=?]", "survey_question[text]"
assert_select "input#survey_question_typ[name=?]", "survey_question[typ]"
end
end
end

View File

@@ -0,0 +1,18 @@
require 'rails_helper'
RSpec.describe "survey/questions/show", :type => :view do
before(:each) do
@survey_question = assign(:survey_question, Survey::Question.create!(
:title => "Title",
:text => "MyText",
:typ => 1
))
end
it "renders attributes in <p>" do
render
expect(rendered).to match(/Title/)
expect(rendered).to match(/MyText/)
expect(rendered).to match(/1/)
end
end